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 contains only n...
分类:
其他好文 时间:
2015-01-20 13:36:44
阅读次数:
172
题目Merge Sorted Array通过率30.7%难度EasyGiven two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough sp...
分类:
其他好文 时间:
2015-01-19 20:46:52
阅读次数:
115
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-19 14:06:46
阅读次数:
265
题目:
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...
分类:
其他好文 时间:
2015-01-19 09:17:18
阅读次数:
194
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree. 1 /** 2 * De....
分类:
其他好文 时间:
2015-01-17 20:47:15
阅读次数:
211
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree. 1 /** 2 * Def....
分类:
其他好文 时间:
2015-01-17 16:29:31
阅读次数:
160
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 exactly...
分类:
编程语言 时间:
2015-01-17 12:43:35
阅读次数:
193
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 ...
分类:
其他好文 时间:
2015-01-16 14:52:09
阅读次数:
176
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).
You may assume that the intervals were initially sorted according to their start times.
E...
分类:
其他好文 时间:
2015-01-16 13:13:25
阅读次数:
154
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-16 11:19:13
阅读次数:
104