【题目】
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
n! means n (n
1)
...
3
2
1
For example, 10! = 10 9
...
3
2
1 = 3628800,
and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.
Find the sum of the digits...
分类:
其他好文 时间:
2014-06-20 09:34:10
阅读次数:
215
【题目】
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 = 22,
5
/ ...
分类:
其他好文 时间:
2014-06-07 13:57:37
阅读次数:
210
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
当我们计算概率的时候,假设样本空间中的各个样本发生的概率均等,那么,时间A发生的概率为:
所以我们只需要计算时间A包含的样本个数,比上总的样本数,就能得到事件A发生的概率。
基本的counting原则
假设一次实验共有r个阶段,每个阶段有ni种选择,那么总的样本空间是各个阶段的各种选择的乘积。
排列permutation与组合combination
当我们要从n个样本中选...
分类:
其他好文 时间:
2014-06-07 11:34:58
阅读次数:
261
Given a binary tree containing digits
from0-9only, each root-to-leaf path could represent a number.An example is the
root-to-leaf path1->2->3which rep...
分类:
其他好文 时间:
2014-06-06 12:38:42
阅读次数:
255
API: SafeArrayCreate SafeArrayDestroy
SafeArrayGetElement SafeArrayPutElement SafeArrayGetLBound SafeArrayGetUBound1
STDMETHODIMP CMath::Sum(VAR...
分类:
其他好文 时间:
2014-06-06 10:09:56
阅读次数:
150
for(var i =0;i<100;i++) {
}alert(i);//100if(true){ var i="91d"; } alert(i);//91d function add(ad1,ad2){
sum=ad1+ad2; return sum;//如果没有用...
分类:
Web程序 时间:
2014-06-06 09:25:07
阅读次数:
256
【题目大意】给你一个sum和一个limit,现在要你在1~limit中找到一些数来使得这些数的和等于sum,如果能找到的话就输出找到的数的个数和这些数,未找到输出"-1"。比赛的时候被hack了。【题目分析】这题需要将所有的数的lowbit先求出来,然后按照大小排序,然后从后往前判断,如果这个数小于...
分类:
其他好文 时间:
2014-06-05 20:36:44
阅读次数:
307
Given two binary strings, return their sum
(also a binary string).For example,a ="11"b ="1"Return"100".public class
Solution { /**The program is us...
分类:
其他好文 时间:
2014-06-05 14:08:35
阅读次数:
188