Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example,Given [100, 4, 200, 1, 3, 2],The longes...
分类:
其他好文 时间:
2014-12-12 06:43:52
阅读次数:
120
Spiral Matrix IIGiven an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the...
分类:
其他好文 时间:
2014-12-11 15:32:53
阅读次数:
135
Spiral MatrixGiven a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:[...
分类:
其他好文 时间:
2014-12-11 14:00:09
阅读次数:
102
【题目】
Given a collection of integers that might contain duplicates, S, return all possible subsets.
Note:
Elements in a subset must be in non-descending order.The solution set must not con...
分类:
其他好文 时间:
2014-12-10 12:38:33
阅读次数:
196
【题目】
Two elements of a binary search tree (BST) are swapped by mistake.
Recover the tree without changing its structure.
Note:
A solution using O(n)
space is pretty straight forward. Could...
分类:
其他好文 时间:
2014-12-10 12:35:23
阅读次数:
191
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longest ...
分类:
其他好文 时间:
2014-12-10 01:41:06
阅读次数:
194
Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6,...
分类:
其他好文 时间:
2014-12-09 21:19:43
阅读次数:
309
From http://www.tutorialspoint.com/java/java_generics.htmIt would be nice if we could write a single sort method that could sort the elements in an In...
分类:
编程语言 时间:
2014-12-09 19:06:19
阅读次数:
293
It's obvious an DP problem.Let's define:$dp[i] := $ the maximum sum of subarray in the first $i$ elements.From the base point, the optimal subarray ma...
分类:
其他好文 时间:
2014-12-09 17:12:39
阅读次数:
141
Angular overrides quite a few existing HTML elements and attributes. This can be a useful technique in our own applications. We will build a directive...
分类:
Web程序 时间:
2014-12-09 07:04:00
阅读次数:
243