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 nodes with keys less than the node's key.Th...
分类:
其他好文 时间:
2014-10-06 19:32:50
阅读次数:
173
For built-in types, there are conditional operators (, ==, etc.) that compare values and determine when one is greater than, less than, or equal to an...
分类:
其他好文 时间:
2014-10-06 15:56:40
阅读次数:
176
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
For example:
Given the below binary tree and sum ...
分类:
其他好文 时间:
2014-10-06 01:23:59
阅读次数:
228
Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.For exampl...
分类:
其他好文 时间:
2014-10-05 01:54:47
阅读次数:
345
Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.For exampl...
分类:
其他好文 时间:
2014-10-04 11:36:26
阅读次数:
202
Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never diffe...
分类:
其他好文 时间:
2014-10-03 13:39:24
阅读次数:
205
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
For example:
Given the below binary tree and sum
...
分类:
其他好文 时间:
2014-10-02 18:26:13
阅读次数:
174
[leetcode]Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid....
分类:
其他好文 时间:
2014-10-02 12:40:02
阅读次数:
130
Given a linked list, determine if it has a cycle in it.
Follow up:
Can you solve it without using extra space?
这个题目用快慢指针来做,重点在于代码怎么实现的简洁方便理解。
这里用快指针来判断链表是不是有NULL,没有NULL那再继续走,看是否能与慢指针遇上...
分类:
其他好文 时间:
2014-10-01 10:16:10
阅读次数:
309
https://oj.leetcode.com/problems/valid-parentheses/Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the inp...
分类:
编程语言 时间:
2014-10-01 01:40:20
阅读次数:
256