Given an array S of n integers, are there elements
a, b, c, and d in S such that a +
b + c + d = target?
Find all unique quadruplets in the array which gives the sum of target.
Note:
...
分类:
其他好文 时间:
2014-06-05 00:34:06
阅读次数:
240
Given a set of candidate numbers (C) and a
target number (T), find all unique combinations inCwhere the candidate numbers
sums toT.Thesamerepeated num...
分类:
其他好文 时间:
2014-06-04 20:15:09
阅读次数:
289
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-06-04 20:14:25
阅读次数:
287
The set[1,2,3,…,n]contains a total ofn! unique
permutations.By listing and labeling all of the permutations in order,We get the
following sequence (ie...
分类:
其他好文 时间:
2014-06-04 19:56:17
阅读次数:
347
Follow up for "Unique Paths":Now consider if
some obstacles are added to the grids. How many unique paths would there be?An
obstacle and empty space i...
分类:
其他好文 时间:
2014-06-04 19:54:55
阅读次数:
258
Given a collection of numbers that might
contain duplicates, return all possible unique permutations.For
example,[1,1,2]have the following unique perm...
分类:
其他好文 时间:
2014-06-04 19:10:54
阅读次数:
240
【题目】
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?
For example,
Given n = 3, there are a total of 5 unique BST's.
1 3 3 2 1
\ / / / \ 3 2 1 ...
分类:
其他好文 时间:
2014-06-01 15:34:24
阅读次数:
231
【题目】
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.
For example,
Given n = 3, your program should return all 5 unique BST's shown below.
1 3 3 2 1
\ / / / \ ...
分类:
其他好文 时间:
2014-06-01 15:33:45
阅读次数:
297
题目来源:POJ 1679 The Unique MST
题意:判断最小生成树是否唯一 求出次小生成树比较
思路:慢一点的方法就是求出最小生成树 每次去掉最小生成树的一条边再求最小生成树 比较慢
更好的方法是 求出最小生成树后加上一条没有用到的边 然后必定出现一条回路 去掉回路上权值最大的边 做m-(n-1)次
求一次最小生成树 然后n^2的时间预处理最小生成树上两点之间最大的边权 最后...
分类:
其他好文 时间:
2014-06-01 13:53:03
阅读次数:
225
Description
T. Chur teaches various groups of students at university U. Every U-student has a unique Student Identification Number (SIN). A SIN s is an integer in the range 0 ≤ s ≤ MaxSIN with MaxS...
分类:
其他好文 时间:
2014-06-01 07:40:18
阅读次数:
248