Given an array S of n integers, are there elements
a, b, c, and d in S such that a +
b + c + d = target?
Find all unique quadruplets in the array which gives the sum of target.
Note:
...
分类:
其他好文 时间:
2014-06-05 00:34:06
阅读次数:
240
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 ...
分类:
其他好文 时间:
2014-06-03 13:53:21
阅读次数:
309
3-sum
题目描述:
Given an array S of n integers,
are there elements a, b, c in S such
that a + b + c =
0? Find all unique triplets in the array which gives the sum of zero.
题目要求:
Elements...
分类:
其他好文 时间:
2014-06-01 17:31:27
阅读次数:
471
Remove ElementGiven an array and a value,
remove all instances of that value in place and return the new length.The order
of elements can be changed. ...
分类:
其他好文 时间:
2014-06-01 12:29:11
阅读次数:
190
【题目】
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 from B. The number of elements initialized in A and B are...
分类:
其他好文 时间:
2014-06-01 09:21:16
阅读次数:
292
【题目】
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 contain duplicate subsets.
For example,
If S = [1,2,2], a solution ...
分类:
其他好文 时间:
2014-06-01 08:51:06
阅读次数:
292
DescriptionLet us consider sets of positive
integers less than or equal ton. Note that all elements of a set are different.
Also note that the order o...
分类:
其他好文 时间:
2014-05-31 05:12:49
阅读次数:
246
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-05-30 16:20:32
阅读次数:
229
Given an array where elements are sorted in
ascending order, convert it to a height balanced BST./** * Definition for binary
tree * struct TreeNode { ...
分类:
其他好文 时间:
2014-05-30 15:10:23
阅读次数:
227
DescriptionAn ascending sorted sequence of
distinct values is one in which some form of a less-than operator is used to
order the elements from smalle...
分类:
其他好文 时间:
2014-05-30 14:31:10
阅读次数:
297