摘要: Move ZeroesGiven an arraynums, write a function to move all0's to the end of it while maintaining the relative order of the non-zero elements.For exam... 阅读全文
posted @ 2015-09-24 14:32 Sean_le 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 最近有时间了解下快速排序和归并排序。开始觉得很难,一直没有啃这块骨头,现在发现理解了并不难。快排的思路就是指定一个值,然后将小于他的排到其左边,大于他的排到其右边。 1 #include 2 #include 3 #include 4 #include 5 using namespace s... 阅读全文
posted @ 2015-09-23 16:43 Sean_le 阅读(181) 评论(0) 推荐(0) 编辑
摘要: Reverse BitsReverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as000000101001010000011110100111... 阅读全文
posted @ 2015-09-17 16:22 Sean_le 阅读(124) 评论(0) 推荐(0) 编辑
摘要: Minimum Depth of Binary TreeGiven a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root... 阅读全文
posted @ 2015-09-17 11:46 Sean_le 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Merge Sorted ArrayGiven two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:You may assume thatnums1has enough space (... 阅读全文
posted @ 2015-09-17 11:26 Sean_le 阅读(140) 评论(0) 推荐(0) 编辑
摘要: Combination Sum IIIFind all possible combinations ofknumbers that add up to a numbern, given that only numbers from 1 to 9 can be used and each combin... 阅读全文
posted @ 2015-09-17 10:37 Sean_le 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Combination SumGiven a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thes... 阅读全文
posted @ 2015-09-17 10:24 Sean_le 阅读(138) 评论(0) 推荐(0) 编辑
摘要: Combination Sum IIGiven a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sum... 阅读全文
posted @ 2015-09-17 10:16 Sean_le 阅读(176) 评论(0) 推荐(0) 编辑
摘要: Longest Consecutive SequenceGiven an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4... 阅读全文
posted @ 2015-09-17 00:13 Sean_le 阅读(153) 评论(0) 推荐(0) 编辑
摘要: Path SumGiven a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the give... 阅读全文
posted @ 2015-09-16 23:28 Sean_le 阅读(146) 评论(0) 推荐(0) 编辑