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], [3,1,2],
and [3,2,1].
class Solutio...
分类:
其他好文 时间:
2014-10-23 12:33:50
阅读次数:
223
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-10-23 12:29:48
阅读次数:
136
题目:There is a clever algorithm for computing the Fibonacci numbers in a logarithmic number of steps.Recall the transformation of the state variables a...
分类:
其他好文 时间:
2014-10-22 17:46:46
阅读次数:
108
A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message conta...
分类:
其他好文 时间:
2014-10-22 14:15:29
阅读次数:
134
problem:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not...
分类:
其他好文 时间:
2014-10-22 06:18:10
阅读次数:
149
11598. XORConstraintsTime Limit: 1 secs, Memory Limit: 256 MBDescriptionGiven two integersSandF, what is the XOR (exclusive-or) of all numbers between...
分类:
其他好文 时间:
2014-10-21 22:59:43
阅读次数:
438
Two Sum
Total Accepted:
37848 Total Submissions:
206006
Given an array of integers, find two numbers such that they add up to a specific target number.
The function twoSum should return ...
分类:
其他好文 时间:
2014-10-21 21:44:10
阅读次数:
267
Problem Description
Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N <= 1000000). Your task is to find a number K which make a[K] = b...
分类:
其他好文 时间:
2014-10-21 21:38:27
阅读次数:
258
[leetcode]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....
分类:
其他好文 时间:
2014-10-21 12:22:27
阅读次数:
170
题意:问第n(n
题目链接:http://poj.org/problem?id=1338
——>>1, 2, 3, 4, 5, 6, 8, ...
假设小根堆存以上丑数,那么每次取出最小的数,这个最小的数nMin,它可以生成三个数:nMin * 2, nMin * 3, nMin * 5,将这三个数放入小根堆继续,一直复筛出1500个丑数为止。
小根堆可用优先队列来替代。
#inclu...
分类:
其他好文 时间:
2014-10-21 10:21:52
阅读次数:
215