题目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 r...
分类:
其他好文 时间:
2014-07-15 23:21:33
阅读次数:
218
3SumGiven an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:El...
分类:
其他好文 时间:
2014-07-15 08:51:50
阅读次数:
231
def Mean(t): """均值""" return float(sum(t)) / len(t)
分类:
其他好文 时间:
2014-07-15 00:09:49
阅读次数:
516
联通块是指给定n个点,输入a,b(1#includeusing namespace std;const int maxn=1010;int p[maxn];//作为每个独立的点 int sum[maxn];//每个节点下面连接的点 int find(int x) {if(x==p[x])return...
分类:
移动开发 时间:
2014-07-14 22:21:30
阅读次数:
403
题目很好很有意思。告诉你n个序列中,任意一个连续子序列的和与0相比较的结果。构造一个满足条件的序列。对于从x->y这一段的和,如果大于0,那么sum[x]>sum[y-1],显然我们可以得到每一个sum的大小关系。由于这个满足条件的sum关系已经考虑了所有的源系列的大小关系,所以只要我们生成了一个满...
分类:
其他好文 时间:
2014-07-14 18:00:24
阅读次数:
193
3Sum ClosestGiven an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three int...
分类:
其他好文 时间:
2014-07-14 15:23:22
阅读次数:
171
4SumGiven an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum...
分类:
其他好文 时间:
2014-07-14 15:02:09
阅读次数:
228
本文载自【k sum problem】以及【NSum】有位同僚,对该问题做出了代码的小结,想看吗?戳我戳我。问题陈述:在一个数组,从中找出k个数(每个数不能重复取。数组中同一个值有多个,可以取多个),使得和为零。找出所有这样的组合,要求没有重复项(只要值不同即可,不要求在原数组中的index不同)解...
分类:
其他好文 时间:
2014-07-14 14:16:00
阅读次数:
219
1、进入information_schema数据库(存放了其他的数据库的信息)useinformation_schema;2、查询所有数据的大小:SELECTconcat(round(sum(DATA_LENGTH/1024/1024),2),’MB’)asdataFROMTABLES;3、查看指定数据库的大小:比如查看数据库hellodb的大小SELECTconcat(round(sum(DATA_..
分类:
数据库 时间:
2014-07-14 11:39:30
阅读次数:
253
Combination Sum IIGiven a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sum...
分类:
其他好文 时间:
2014-07-14 10:42:22
阅读次数:
192