Given an array S of n integers, are there
elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the
array which gives the sum of ...
分类:
其他好文 时间:
2014-05-26 14:02:27
阅读次数:
263
Given a collection of candidate numbers (C) and
a target number (T), find all unique combinations inCwhere the candidate numbers
sums toT.Each number ...
分类:
其他好文 时间:
2014-05-26 13:59:59
阅读次数:
237
Given an arraySofnintegers, are there
elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in
the array which gives the sum of ...
分类:
其他好文 时间:
2014-05-26 13:56:05
阅读次数:
269
克鲁斯卡尔
struct edge
{
int u, v, w;
}e[maxn];
int f[110];
bool cmp(edge a, edge b)
{
return a.w < b.w;
}
int find(int x)
{
if(x != f[x])
return f[x] = find(f[x]);
return f[x];
}
int MST()
{
int...
分类:
其他好文 时间:
2014-05-23 02:15:51
阅读次数:
267
MySQL各种索引(因为是浅析大多都不刻意区分搜索引擎)
INDEX(普通索引):最基本的索引,没有任何限制
ALTER TABLE `table_name` ADD INDEX index_name ( `column` )
UNIQUE(唯一索引):与"普通索引"类似,不同的就是:索引列的值必须唯一,但允许有空值。
ALTER TABLE `table_name` ADD UNIQUE (`column`)
注:创建唯一索引的目的不是为了提高访问速度,而只...
分类:
数据库 时间:
2014-05-23 01:24:44
阅读次数:
313
【题目】
Given a collection of numbers that might contain duplicates, return all possible unique permutations.
For example,
[1,1,2] have the following unique permutations:
[1,1,2], [1,2,1], and [2,1,1].
【题意】
给定一个候选数集合,候选集中可能存在重复数,返回所有的排列
【思路】
...
分类:
其他好文 时间:
2014-05-22 17:32:17
阅读次数:
247
Given 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:Elemen...
分类:
其他好文 时间:
2014-05-22 16:53:52
阅读次数:
173
【题目】
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.
Each number in C may only be used once in the combination.
Note:
All numbers (including target) will be ...
分类:
其他好文 时间:
2014-05-21 15:55:25
阅读次数:
259
【题目】
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.
The same repeated number may be chosen from C unlimited number of times.
Note:
All numbers (including target) w...
分类:
其他好文 时间:
2014-05-21 15:21:28
阅读次数:
292
今天做判断插入用到了MySQL中ON DUPLICATE KEY UPDATE,现在Mark以下!
如果你想做到数据库中没有数据的话插入数据、有数据的话更新数据,那么你可以选择ON DUPLICATE KEY UPDATE。
ON DUPLICATE KEY UPDATE能够在UNIQUE索引或PRIMARY KEY存在的情况下对旧行执行UPDATE操作。
例如:如果列a被定义为UNIQUE,并且包含值1,则以下两个语句具有相同的效果:...
分类:
数据库 时间:
2014-05-21 13:28:45
阅读次数:
426