随笔分类 -  LeetCode

上一页 1 ··· 46 47 48 49 50 51 52 53 54 ··· 61 下一页
摘要:Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index. According 阅读全文
posted @ 2015-09-04 07:54 Grandyang 阅读(17980) 评论(2) 推荐(0) 编辑
摘要:Convert a non-negative integer num to its English words representation. Example 1: Input: num = 123 Output: "One Hundred Twenty Three" Example 2: Inpu 阅读全文
posted @ 2015-08-31 12:18 Grandyang 阅读(16391) 评论(6) 推荐(1) 编辑
摘要:Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example, Given nums = [0, 1, 阅读全文
posted @ 2015-08-25 10:10 Grandyang 阅读(24883) 评论(4) 推荐(2) 编辑
摘要:Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. Example: Note: Hint: 这道题是之前那 阅读全文
posted @ 2015-08-19 23:28 Grandyang 阅读(30304) 评论(11) 推荐(3) 编辑
摘要:Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. Example 阅读全文
posted @ 2015-08-19 13:14 Grandyang 阅读(23177) 评论(2) 推荐(2) 编辑
摘要:Given an integer array nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements tha 阅读全文
posted @ 2015-08-19 00:42 Grandyang 阅读(21723) 评论(15) 推荐(3) 编辑
摘要:Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. Example: Follow up:Could you do it without any lo 阅读全文
posted @ 2015-08-18 23:36 Grandyang 阅读(15900) 评论(6) 推荐(2) 编辑
摘要:Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \ 2 3 \ 5 All root-to-leaf paths are: ["1->2->5" 阅读全文
posted @ 2015-08-17 22:45 Grandyang 阅读(14247) 评论(5) 推荐(0) 编辑
摘要:Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = ... 阅读全文
posted @ 2015-08-02 01:07 Grandyang 阅读(14389) 评论(5) 推荐(2) 编辑
摘要:Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. Th 阅读全文
posted @ 2015-07-28 12:54 Grandyang 阅读(16127) 评论(8) 推荐(1) 编辑
摘要:Write an efficient algorithm that searches for a target value in an m x n integer matrix. The matrix has the following properties: Integers in each ro 阅读全文
posted @ 2015-07-23 00:58 Grandyang 阅读(19491) 评论(6) 推荐(1) 编辑
摘要:Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k num 阅读全文
posted @ 2015-07-18 12:09 Grandyang 阅读(37707) 评论(5) 推荐(0) 编辑
摘要:Given an array nums of n integers where n > 1, return an array output such that output[i] is equal to the product of all the elements of numsexcept nu 阅读全文
posted @ 2015-07-16 08:29 Grandyang 阅读(28442) 评论(2) 推荐(5) 编辑
摘要:Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 -> 3 - 阅读全文
posted @ 2015-07-15 10:20 Grandyang 阅读(15665) 评论(2) 推荐(0) 编辑
摘要:Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowes 阅读全文
posted @ 2015-07-13 07:10 Grandyang 阅读(28690) 评论(14) 推荐(1) 编辑
摘要:Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia 阅读全文
posted @ 2015-07-12 10:08 Grandyang 阅读(14542) 评论(2) 推荐(0) 编辑
摘要:Given a singly linked list, determine if it is a palindrome. Example 1: Input: 1->2 Output: false Example 2: Input: 1->2->2->1 Output: true Follow up: 阅读全文
posted @ 2015-07-10 12:38 Grandyang 阅读(34022) 评论(10) 推荐(3) 编辑
摘要:Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n. Example 1: Input: n = 13 Output: 阅读全文
posted @ 2015-07-08 02:50 Grandyang 阅读(19806) 评论(5) 推荐(3) 编辑
摘要:Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue. pop() -- Removes the element from in front 阅读全文
posted @ 2015-07-07 10:30 Grandyang 阅读(13416) 评论(2) 推荐(1) 编辑
摘要:Given an integer, write a function to determine if it is a power of two. Example 1: Example 2: Example 3: 这道题让我们判断一个数是否为2的次方数,而且要求时间和空间复杂度都为常数,那么对于这种玩 阅读全文
posted @ 2015-07-06 04:40 Grandyang 阅读(20873) 评论(5) 推荐(2) 编辑

上一页 1 ··· 46 47 48 49 50 51 52 53 54 ··· 61 下一页
Fork me on GitHub