Design an iterator over a binary search tree with the following properties:Elements are visited in ascending order (i.e. an inorder traversal)next() a...
分类:
其他好文 时间:
2014-12-31 07:34:29
阅读次数:
168
The code base version is an integer and start from 1 to n. One day, someone commit a bad version in the code case, so it caused itself and the followi...
分类:
其他好文 时间:
2014-12-31 06:18:42
阅读次数:
153
Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space i...
分类:
其他好文 时间:
2014-12-30 08:09:14
阅读次数:
161
Given a root of Binary Search Tree with unique value for each node. Remove the node with given value. If there is no such a node with given value in t...
分类:
其他好文 时间:
2014-12-30 08:08:42
阅读次数:
236
Given an array ofnobjects with k different colors (numbered from 1 to k), sort them so that objects of the same color are adjacent, with the colors in...
分类:
其他好文 时间:
2014-12-30 07:04:30
阅读次数:
142
Write an efficient algorithm that searches for a value in an m x n matrix, return the occurrence of it.This matrix has the following properties: * In....
分类:
其他好文 时间:
2014-12-30 07:02:58
阅读次数:
233
Numbers keep coming, return the median of numbers at every time a new number added.ExampleFor numbers coming list: [1, 2, 3, 4, 5], return [1, 1, 2, 2...
分类:
其他好文 时间:
2014-12-29 10:19:09
阅读次数:
123
Given an integer array, heapify it into a min-heap array.For a heap array A, A[0] is the root of heap, and for each A[i], A[i * 2 + 1] is the left chi...
Given a list of integers, which denote a permutation.Find the previous permutation in ascending order.NoteThe list may contains duplicate integers.Exa...
分类:
其他好文 时间:
2014-12-29 10:15:41
阅读次数:
177
Given a sequence of integers, find the longest increasing subsequence (LIS).You code should return the length of the LIS.ExampleFor [5, 4, 1, 2, 3], t...
分类:
其他好文 时间:
2014-12-29 06:31:53
阅读次数:
131