Compare two version numbers version1 and version1.
If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.
You may assume that the version strings are non-empty and co...
分类:
其他好文 时间:
2015-01-10 16:40:07
阅读次数:
135
Given an array of sizen, find the majority element. The majority element is the element that appears more than? n/2 ?times.You may assume that the arr...
分类:
其他好文 时间:
2015-01-09 23:37:59
阅读次数:
226
Construct Binary Tree from Preorder and Inorder TraversalGiven preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume...
分类:
其他好文 时间:
2015-01-09 18:46:57
阅读次数:
151
Insert IntervalGiven a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals...
分类:
其他好文 时间:
2015-01-09 16:59:30
阅读次数:
133
题目:
Suppose a sorted array is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4
5 6 7 0 1 2).
Find the minimum element.
You may assume no duplicate exi...
分类:
编程语言 时间:
2015-01-09 12:42:03
阅读次数:
253
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have
exact...
分类:
其他好文 时间:
2015-01-09 09:19:26
阅读次数:
176
The problem:Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node con...
分类:
其他好文 时间:
2015-01-09 00:07:50
阅读次数:
208
Given an array of size n, find the majority element. The majority element is the element that appears more than ?
n/2 ? times.
You may assume that the array is non-empty and the majority element al...
分类:
编程语言 时间:
2015-01-08 18:09:44
阅读次数:
157
The problem:Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.My...
分类:
其他好文 时间:
2015-01-08 13:15:07
阅读次数:
109
The problem:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.My ...
分类:
其他好文 时间:
2015-01-08 12:54:39
阅读次数:
97