N-Queens II (LEVEL 4 难度级别,最高级5)Follow up for N-Queens problem.Now, instead outputting board configurations, return the totalnumber of distinct solutio...
分类:
其他好文 时间:
2014-12-18 20:18:25
阅读次数:
183
【题目】
Given a string S and a string T, count the number of distinct subsequences of T in S.
A subsequence of a string is a new string which is formed from the original string by deleting some (...
分类:
其他好文 时间:
2014-12-18 12:03:46
阅读次数:
118
题目链接:http://codeforces.com/problemset/problem/495/B题目意思:给出两个非负整数a,b,求出符合这个等式 的所有x,并输出 x 的数量,如果 x 有无限多个,那么输出 infinity。 想了半个多小时......有个地方想遗漏了。 a mod ...
分类:
其他好文 时间:
2014-12-17 23:53:11
阅读次数:
256
【L4】N-Queens解题报告N-Queens Total Accepted: 16418 Total Submissions: 63309 MySubmissionsThe n-queens puzzle is the problem of placing n queens on an n×nc...
分类:
其他好文 时间:
2014-12-17 20:47:23
阅读次数:
311
【题目】
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
If the number of nodes is not a multiple of k then left-out nodes in the end should remai...
分类:
其他好文 时间:
2014-12-17 18:37:28
阅读次数:
188
【题目】
Given a list, rotate the list to the right by k places, where k is non-negative.
For example:
Given 1->2->3->4->5->NULL and k = 2,
return 4->5->1->2->3->NULL.
【解析】
题意:把链表循环右移k个结点。
不是...
分类:
其他好文 时间:
2014-12-17 18:30:18
阅读次数:
148
【题目】
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],
an...
分类:
其他好文 时间:
2014-12-17 12:49:36
阅读次数:
140
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5143题目意思:给出 1, 2, 3, 4 的数量,分别为a1, a2, a3, a4,问是否在每个数只使用一次的前提下,分成若干部分,每部分数的长度 >= 3且满足是等差数列。可以的话输出 Yes ,否...
分类:
其他好文 时间:
2014-12-16 22:25:59
阅读次数:
264
【题目】
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 lowes...
分类:
其他好文 时间:
2014-12-16 11:50:47
阅读次数:
146
【Combination Sum I】
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 cho...
分类:
其他好文 时间:
2014-12-16 11:45:46
阅读次数:
186