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
/ ...
分类:
其他好文 时间:
2014-10-02 18:25:03
阅读次数:
153
Given a binary tree, flatten it to a linked list in-place.
For example,
Given
1
/ 2 5
/ \ 3 4 6
The flattened tree should look like:
1
...
分类:
其他好文 时间:
2014-10-02 15:12:43
阅读次数:
193
Follow up for problem "Populating Next Right Pointers in Each Node".
What if the given tree could be any binary tree? Would your previous solution still work?
Note:
You may only use constant ...
分类:
其他好文 时间:
2014-10-02 14:18:33
阅读次数:
267
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ ...
分类:
其他好文 时间:
2014-10-02 09:45:52
阅读次数:
184
Symmetric TreeGiven a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric...
分类:
其他好文 时间:
2014-10-02 05:53:22
阅读次数:
170
Sum Root to Leaf NumbersGiven a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-l...
分类:
其他好文 时间:
2014-10-02 03:56:22
阅读次数:
198
这个题目是考察二查搜索树,但其实实际上并不需要我们建立一个二叉树,我们只需要在重构的过程中,利用递归的思想直接进行一次遍历即可。 本代码中使用到了lambda表达式,所以代码量比较简洁,只有40行,c++里面还...
分类:
其他好文 时间:
2014-10-02 03:29:02
阅读次数:
142
从给定的有序链表生成一颗平衡二叉树。
解题思路:最容易想到的就是利用数组生成二叉树的方法,找到中间节点作为二叉树的root节点,然后分别对左右链表递归调用分别生成左子树和右子树。时间复杂度O(N*lgN)...
分类:
其他好文 时间:
2014-10-01 23:36:31
阅读次数:
243
$args # 这个变量等于请求行中的参数。$binary_remote_addr # 远程地址的二进制表示$body_bytes_sent # 已发送的消息体字节数$content_length # 请求头中的Content-length字段$content_type...
分类:
其他好文 时间:
2014-10-01 21:35:11
阅读次数:
194
Given a binary tree
struct TreeLinkNode {
TreeLinkNode *left;
TreeLinkNode *right;
TreeLinkNode *next;
}
Populate each next pointer to point to its next right node. ...
分类:
其他好文 时间:
2014-10-01 19:16:51
阅读次数:
223