【题目】
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
/ 4 8
/ / 11 13 4
...
分类:
其他好文 时间:
2014-06-20 10:53:08
阅读次数:
181
【题目】
Given a binary tree
struct TreeLinkNode {
TreeLinkNode *left;
TreeLinkNode *right;
TreeLinkNode *next;
}
Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be...
分类:
其他好文 时间:
2014-06-07 14:28:36
阅读次数:
215
题目
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-06-07 13:47:22
阅读次数:
191
Let d(n) be defined as the sum of proper divisors of n (numbers less than
n which divide evenly into n).
If d(a) = b and d(b) = a, where a
b, then a and b are an amicable pair and each of a and
b...
分类:
其他好文 时间:
2014-06-07 13:40:53
阅读次数:
226
并查集,
删除节点操作,可以用新建节点代替
维护每个点到跟节点的距离
Gears
Time Limit: 2 Seconds Memory Limit: 65536 KB
Bob has N (1 ≤ N ≤ 2*105) gears (numbered from 1 to N). Each gear can rotate clockwise or co...
分类:
其他好文 时间:
2014-06-07 11:33:37
阅读次数:
227
只用一个循环,就可以找出被选中的checkbox的值 var s; $("[name =
b]:checkbox").each(function () { if (this.checked) { s += $(this).val() + "|"; }
});alert(s); 这样就可以了
分类:
Web程序 时间:
2014-06-06 07:27:29
阅读次数:
286
Given a sorted linked list, delete all
duplicates such that each element appear onlyonce.For
example,Given1->1->2, return1->2.Given1->1->2->3->3,
retu...
分类:
其他好文 时间:
2014-06-06 07:00:36
阅读次数:
269
Given a sorted array, remove the duplicates in
place such that each element appear only once and return the new length.Do not
allocate extra space for...
分类:
其他好文 时间:
2014-06-06 06:53:19
阅读次数:
347
Given a binary tree struct TreeLinkNode {
TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next
pointe...
分类:
其他好文 时间:
2014-06-05 13:42:24
阅读次数:
264
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 stil...
分类:
其他好文 时间:
2014-06-05 13:26:37
阅读次数:
335