摘要:
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... 阅读全文
摘要:
Write a function to find the longest common prefix string amongst an array of strings.题解: 寻找一组字符串的最长公共前缀。最简单的方法,用一个字符串记录当前最长的公共前缀,然后依次比较。时间复杂度: O(N). ... 阅读全文
摘要:
Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]have the following unique perm... 阅读全文
摘要:
Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))... 阅读全文
摘要:
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... 阅读全文