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,...
分类:
其他好文 时间:
2014-05-27 02:42:35
阅读次数:
202
Questin:There is an array A[N] of N numbers.
You have to compose an array Output[N] such that Output[i] will be equal to
multiplication of all the ele...
分类:
其他好文 时间:
2014-05-23 23:48:14
阅读次数:
429
Combination Sum IGiven a set of candidate
numbers (C) and a target number (T), find all unique combinations in C where the
candidate numbers sums to T...
分类:
其他好文 时间:
2014-05-19 16:41:14
阅读次数:
269
题目链接Given two numbers represented as strings,
return multiplication of the numbers as a string.Note: The numbers can be
arbitrarily large and are non-...
分类:
其他好文 时间:
2014-05-19 14:10:25
阅读次数:
250
题目链接 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 si...
分类:
其他好文 时间:
2014-05-19 13:53:32
阅读次数:
296
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 ...
分类:
其他好文 时间:
2014-05-19 12:05:23
阅读次数:
386
【题目】
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 order (ie, sorted in ascending order).
The replac...
分类:
其他好文 时间:
2014-05-18 09:54:53
阅读次数:
242
题目链接:
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5235
Calculate the Function
Time Limit: 2 Seconds Memory Limit: 65536 KB
You are given a list of numbers A1 A2 .. AN...
分类:
其他好文 时间:
2014-05-18 09:52:49
阅读次数:
410
题目连接:Codefoces 432C Prime Swaps
题目大意:给出一个序列,长度为n,要求用5n以内的交换次数使得序列有序,并且交换的i,j两个位置的数时要满足,j?i+1为素数。
解题思路:a数组为对应的序列,b数组为对应的有序序列,p为对应数的位置。每次从有序序列最小的位置开始,该为必须放b[i]才对,所以p[b[i]]=i,否则就要将b[i]尽量往前换,直到换到i的位...
分类:
其他好文 时间:
2014-05-18 09:51:47
阅读次数:
221
Problem Description
For a decimal number x with n digits (AnAn-1An-2 ... A2A1), we define its weight as F(x) = An * 2n-1 + An-1 * 2n-2 + ... + A2 * 2 + A1 *
1. Now you are given two numbers A and...
分类:
其他好文 时间:
2014-05-18 06:35:50
阅读次数:
300