题目:
Given 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. It doesn't matter what you leave beyond the n...
分类:
其他好文 时间:
2014-08-31 17:20:11
阅读次数:
271
Spiral Matrix
Total Accepted: 12721 Total
Submissions: 62094My Submissions
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.
For ex...
分类:
其他好文 时间:
2014-08-31 17:19:01
阅读次数:
210
Spiral Matrix II
Total Accepted: 12773 Total
Submissions: 41526My Submissions
Given an integer n, generate a square matrix filled with elements from 1 to n2 in
spiral order.
For exampl...
分类:
其他好文 时间:
2014-08-31 17:17:11
阅读次数:
128
Given an array where elements are sorted in ascending order, convert it to a height balanced BST./** * Definition for binary tree * public class TreeN...
分类:
其他好文 时间:
2014-08-30 01:10:48
阅读次数:
333
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 you devis...
分类:
其他好文 时间:
2014-08-29 21:28:08
阅读次数:
313
Young cryptoanalyst Georgie is investigating different schemes of generating random integer numbers
ranging from 0 to m - 1.
He thinks that standard random number generators are not good enough, s...
分类:
其他好文 时间:
2014-08-29 21:26:38
阅读次数:
317
Given 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. It doesn't mat...
分类:
其他好文 时间:
2014-08-29 02:35:13
阅读次数:
203
LeetCode: Recover Binary Search TreeTwo elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure....
分类:
其他好文 时间:
2014-08-28 23:58:36
阅读次数:
385
给定一个整数数组(长度不小于3) 和 一个目标值, 从数组中找出3个元素, 使得它们的和与目标值最接近, 返回这个和. 可以认为每个输入的组合都是只有唯一解的.解法思路参考: Finding three elements in an array whose sum is closest to an ...
分类:
其他好文 时间:
2014-08-28 22:38:06
阅读次数:
212
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-08-28 19:33:55
阅读次数:
266