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...
分类:
其他好文 时间:
2014-06-04 20:13:41
阅读次数:
350
Given a matrix ofmxnelements (mrows,ncolumns),
return all elements of the matrix in spiral order.For example,Given the
following matrix:[ [ 1, 2, 3 ]....
分类:
其他好文 时间:
2014-06-04 20:06:52
阅读次数:
256
Given two integersnandk, return all possible
combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution
is:[ [2,4], [3,4], [2,3], [1...
分类:
其他好文 时间:
2014-06-04 20:02:13
阅读次数:
228
Given an absolute path for a file (Unix-style),
simplify it.For example,path="/home/", =>"/home"path="/a/./b/../../c/",
=>"/c"click to show corner cas...
分类:
其他好文 时间:
2014-06-04 19:32:14
阅读次数:
270
Find the contiguous subarray within an array
(containing at least one number) which has the largest sum.For example, given
the array[?2,1,?3,4,?1,2,1,...
分类:
其他好文 时间:
2014-06-04 19:30:13
阅读次数:
230
Given an integern, generate a square matrix
filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should
return the following matri...
分类:
其他好文 时间:
2014-06-04 19:28:23
阅读次数:
220
Given two binary strings, return their sum
(also a binary string).For example,a ="11"b
="1"Return"100".classSolution{public:stringaddBinary(stringa,st...
分类:
其他好文 时间:
2014-06-04 19:23:09
阅读次数:
235
Given a sorted linked list, delete all
duplicates such that each element appear onlyonce.For
example,Given1->1->2, return1->2.Given1->1->2->3->3,
retu...
分类:
其他好文 时间:
2014-06-04 19:19:16
阅读次数:
205
Follow up for "Remove Duplicates":What if
duplicates are allowed at mosttwice?For example,Given sorted array A
=[1,1,1,2,2,3],Your function should ret...
分类:
其他好文 时间:
2014-06-04 19:12:47
阅读次数:
273
Given a collection of numbers, return all
possible permutations.For example,[1,2,3]have the following
permutations:[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,...
分类:
其他好文 时间:
2014-06-04 19:10:16
阅读次数:
155