给定一个整数序列,求解一个子序列,子序列之和等于给定目标值。子序列满足以下条件:
1)子序列是有序的
2)子序列的元素个数不限,可以是给定元素的重复元素。
3)结果中的子序列是唯一的
原题描述如下:
Given a set of candidate numbers (C) and a target number (T), find all unique combinations ...
分类:
其他好文 时间:
2014-06-11 06:26:03
阅读次数:
302
while loops
定义与实例
i = 0
numbers = []
while i < 6:
print "At the top i is %d" % i
numbers.append(i)
i = i + 1
print "Numbers now: ", numbers
print "At the bottom i is %d" % ...
分类:
编程语言 时间:
2014-06-11 00:59:17
阅读次数:
410
Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two...
分类:
其他好文 时间:
2014-06-11 00:35:15
阅读次数:
243
最小生成树: 一个连通图的生成树是一个极小连通子图,它含有图中全部顶点,但只有足以构成一棵树的n-1条边。这种构造连通网的最小代价生成树称为最小生成树,详见数据结构之图(术语、存储结构、遍历)。
求连通网的最小生成树有两种经典方法:普里姆(Prime)算法和克鲁斯卡尔(Kruskal)算法。
1、Prime算法
(1)算法描述:假设N=(V,{E})是连通网,TE是N上最小生成树中边的集合。从V中任选一个顶点u0,算法从U={u0}(u0∈V),TE={}开始,重复执行以下步骤:
在所有u∈U、v∈V-U...
分类:
其他好文 时间:
2014-06-10 15:38:52
阅读次数:
211
题意:http://acdream.info/problem?pid=1112
Problem Description
Here is Alice and Bob again !
Alice and Bob are playing a game. There are several numbers.First, Alice choose a number n.Then he c...
分类:
其他好文 时间:
2014-06-10 14:48:56
阅读次数:
236
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
If such arrangement is not possible, it must rearrange it as the lowest possible...
分类:
其他好文 时间:
2014-06-10 10:52:42
阅读次数:
192
CSV全称 Comma Separated
values,是一种用来存储数据的纯文本文件格式,通常用于电子表格或数据库软件。用Excel或者Numbers都可以导出CSV格式的数据。CSV文件的规则0
开头是不留空,以行为单位。 1 可含或不含列名,含列名则居文件第一行。2 一行数据不垮行,无空行....
分类:
其他好文 时间:
2014-06-10 10:03:30
阅读次数:
204
戳我去解题Given a collection of numbers, return all
possible permutations.For example,[1,2,3]have the following
permutations:[1,2,3],[1,3,2],[2,1,3],[2,3,1...
分类:
其他好文 时间:
2014-06-10 08:42:11
阅读次数:
184
bloomFilter算法的基本原理,设计实现一个生成100万个不重复的随机数。...
分类:
其他好文 时间:
2014-06-10 07:50:25
阅读次数:
228
原题地址:https://oj.leetcode.com/problems/combination-sum-ii/题意:Given
a collection of candidate numbers (C) and a target number (T), find all unique
combi...
分类:
编程语言 时间:
2014-06-09 17:41:58
阅读次数:
320