摘要: Given an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Your algorithm should ru... 阅读全文
posted @ 2014-06-17 23:11 Double_win 阅读(243) 评论(0) 推荐(0) 编辑
摘要: Write a function to find the longest common prefix string amongst an array of strings.题解: 寻找一组字符串的最长公共前缀。最简单的方法,用一个字符串记录当前最长的公共前缀,然后依次比较。时间复杂度: O(N). ... 阅读全文
posted @ 2014-06-17 21:17 Double_win 阅读(401) 评论(0) 推荐(0) 编辑
摘要: Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]have the following unique perm... 阅读全文
posted @ 2014-06-17 18:14 Double_win 阅读(238) 评论(0) 推荐(0) 编辑
摘要: Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))... 阅读全文
posted @ 2014-06-17 16:27 Double_win 阅读(259) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After re... 阅读全文
posted @ 2014-06-17 14:58 Double_win 阅读(199) 评论(0) 推荐(0) 编辑