Binary Search Tree Iterator
Total Accepted: 1141
Total Submissions: 3857
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.
...
分类:
其他好文 时间:
2015-01-02 13:28:25
阅读次数:
165
【题目】
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.
For example:
Given the below binary tree and sum
= 22,
5
...
分类:
其他好文 时间:
2015-01-02 12:20:43
阅读次数:
104
Given preorder and inorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
class Solution {
private:
TreeNode *root;
v...
分类:
其他好文 时间:
2015-01-02 09:46:36
阅读次数:
107
https://oj.leetcode.com/problems/binary-tree-postorder-traversal/http://blog.csdn.net/ljphhj/article/details/21369053/**
*Definitionforbinarytree
*publicclassTreeNode{
*intval;
*TreeNodeleft;
*TreeNoderight;
*TreeNode(intx){val=x;}
*}
*/
publicclassSolution..
分类:
其他好文 时间:
2015-01-02 07:33:36
阅读次数:
132
https://oj.leetcode.com/problems/path-sum-ii/http://fisherlei.blogspot.com/search?q=Path+Sum+II+/**
*Definitionforbinarytree
*publicclassTreeNode{
*intval;
*TreeNodeleft;
*TreeNoderight;
*TreeNode(intx){val=x;}
*}
*/
publicclassSolution{
publicList<List&..
分类:
其他好文 时间:
2015-01-02 07:33:25
阅读次数:
151
题目:Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representat...
分类:
其他好文 时间:
2015-01-02 06:29:15
阅读次数:
197
题目:(DP)Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST...
分类:
其他好文 时间:
2015-01-02 06:24:14
阅读次数:
195
【题目】
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 tre...
分类:
其他好文 时间:
2015-01-01 23:49:22
阅读次数:
189
【题目】
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent
a number.
An example is the root-to-leaf path 1->2->3 which represents the number 123.
Fin...
分类:
其他好文 时间:
2015-01-01 22:33:42
阅读次数:
208
Binary Search Tree IteratorImplement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Callin...
分类:
其他好文 时间:
2015-01-01 17:16:17
阅读次数:
530