The problem:Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(...
分类:
其他好文 时间:
2015-01-09 06:54:36
阅读次数:
132
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...
分类:
其他好文 时间:
2015-01-08 21:32:10
阅读次数:
209
SubsetsGiven a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set mus...
分类:
其他好文 时间:
2015-01-08 21:27:08
阅读次数:
361
方法简介: empty()This method removes not only child (and other descendant) elements, but also any text within the set of matched elements. This is because...
分类:
Web程序 时间:
2015-01-08 14:37:27
阅读次数:
378
Given two sorted integer arrays A and B, merge B into A as one sorted array.
Note:
You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements fro...
分类:
其他好文 时间:
2015-01-08 09:43:18
阅读次数:
169
The problem:Given an array where elements are sorted in ascending order, convert it to a height balanced BST.My analysis:The recursion is the best way...
分类:
其他好文 时间:
2015-01-08 00:49:30
阅读次数:
265
Spiral MatrixGiven a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:[...
分类:
其他好文 时间:
2015-01-08 00:45:10
阅读次数:
245
There is a sequence of brackets, which supports two kinds of operations.we can choose a interval [l,r], and set all the elements range in this inter.....
分类:
其他好文 时间:
2015-01-07 20:30:57
阅读次数:
178
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 consecutive elements sequence is [1,
2,...
分类:
编程语言 时间:
2015-01-07 16:52:23
阅读次数:
141
Recover Binary Search TreeTwo elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A sol...
分类:
其他好文 时间:
2015-01-07 14:40:01
阅读次数:
173