随笔分类 -  LeetCode

上一页 1 ··· 46 47 48 49 50 51 52 53 54 ··· 61 下一页
摘要:Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, giv 阅读全文
posted @ 2015-09-20 01:02 Grandyang 阅读(18949) 评论(0) 推荐(1)
摘要:Given a string that contains only digits 0-9 and a target value, return all possibilities to add binaryoperators (not unary) +, -, or * between the di 阅读全文
posted @ 2015-09-16 21:01 Grandyang 阅读(20163) 评论(6) 推荐(2)
摘要:Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. Example 1: Input: n = 12 O 阅读全文
posted @ 2015-09-11 12:06 Grandyang 阅读(42063) 评论(17) 推荐(2)
摘要:You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality c 阅读全文
posted @ 2015-09-08 02:30 Grandyang 阅读(10730) 评论(3) 推荐(0)
摘要:Given an array of integers citations where citations[i] is the number of citations a researcher received for their ith paper and citations is sorted i 阅读全文
posted @ 2015-09-05 05:45 Grandyang 阅读(12508) 评论(7) 推荐(0)
摘要: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 阅读(18190) 评论(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 阅读(16611) 评论(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 阅读(25300) 评论(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 阅读(30589) 评论(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 阅读(23301) 评论(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 阅读(21997) 评论(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 阅读(16005) 评论(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 阅读(14400) 评论(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 阅读(14507) 评论(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 阅读(16564) 评论(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 阅读(19735) 评论(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 阅读(38362) 评论(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 阅读(29131) 评论(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 阅读(15758) 评论(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 阅读(29411) 评论(14) 推荐(1)

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