problem:
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?
For example,
Given n = 3, there are a total of 5 unique BST's.
1 3 3 ...
分类:
其他好文 时间:
2015-04-17 09:45:12
阅读次数:
108
把以字符串表示的两个二进制数相加。【思路】活学活用昨天学到的reverse。将倒序相加变成正序相加。但这样的话,就要用到三个reverse,两个原串,最后还要把结果翻转。可能对速度有影响,经测试,好像还比不翻转快一点点。一个point是,两串长度不同,一串加完了另一串怎么办?我的办法是将其视为0,这...
分类:
其他好文 时间:
2015-04-17 09:33:59
阅读次数:
135
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.Fo...
分类:
其他好文 时间:
2015-04-17 08:21:12
阅读次数:
101
Binary Tree Right Side View2015.4.17 06:04Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can...
分类:
其他好文 时间:
2015-04-17 07:12:41
阅读次数:
142
Reverse Bits2015.4.17 05:42Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as000000101001010...
分类:
其他好文 时间:
2015-04-17 07:09:09
阅读次数:
108
Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exampl...
分类:
其他好文 时间:
2015-04-16 23:42:02
阅读次数:
159
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will return the next smallest number in the BST.Note: next() and has...
分类:
其他好文 时间:
2015-04-16 17:45:41
阅读次数:
151
problem:
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.
For example,
Given n = 3, your program should return all 5 unique BST's shown bel...
分类:
其他好文 时间:
2015-04-16 12:34:36
阅读次数:
111
Binary Tree Level Order Traversal IITotal Accepted:37829Total Submissions:122499My SubmissionsQuestionSolutionGiven a binary tree, return thebottom-up...
分类:
其他好文 时间:
2015-04-16 12:23:02
阅读次数:
176