Dfs:大部分是直接递归枚举,即求满足约束条件下的解,虽不用剪枝,但也需要代码能力。练习递归枚举的题目:1241
Oil Deposits (dfs的连通块个数)1016 Prime Ring Problem1584
蜘蛛牌(简单dfs,简单的剪枝,还有人用DP做(???))1426 Sudoku ...
分类:
其他好文 时间:
2014-05-23 02:54:33
阅读次数:
301
Reorder an array so that odd numbers come
before even numbers.
分类:
其他好文 时间:
2014-05-22 00:38:39
阅读次数:
259
Print 1 to max N bits numbers.
分类:
其他好文 时间:
2014-05-22 00:21:45
阅读次数:
241
Given a sorted linked list, delete all nodes
that have duplicate numbers, leaving onlydistinctnumbers from the original
list.For example,Given1->2->3-...
分类:
其他好文 时间:
2014-05-21 17:51:09
阅读次数:
190
【题目】
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.
Each number in C may only be used once in the combination.
Note:
All numbers (including target) will be ...
分类:
其他好文 时间:
2014-05-21 15:55:25
阅读次数:
259
【题目】
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.
Note:
All numbers (including target) w...
分类:
其他好文 时间:
2014-05-21 15:21:28
阅读次数:
292
【题目】
Given two numbers represented as strings, return multiplication of the numbers as a string.
Note: The numbers can be arbitrarily large and are non-negative.
【题意】
给定用字符串表示的整数,返回两个数的乘积结果字符串。两个数字都非负,且能任意大。
【思路】
1. 考虑其中一个数是0的情况
2. 模拟乘法运算...
分类:
其他好文 时间:
2014-05-21 13:45:37
阅读次数:
214
1、
??
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 num...
分类:
其他好文 时间:
2014-05-21 10:49:10
阅读次数:
221
UVA 10712 - Count the Numbers
题目链接
题意:求区间[A,B]数字中,子串包含N的数字有多少个
思路:数位DP,写了个记忆化乱搞搞过了,dp[i][j][2][2][2],分别表示i位的时候,末尾为j的情况,后面3维用来处理小于的情况,已经出现过子串的情况,前导0的情况,然后注意特判一下数字0的情况,因为一开始要分解数字,而0是不能分解的。
代...
分类:
其他好文 时间:
2014-05-21 09:11:44
阅读次数:
264
题目:
Given an array of integers, find two numbers such that they add up to a specific target number.
The function twoSum should return indices of the two numbers such that they add up t...
分类:
其他好文 时间:
2014-05-21 07:42:18
阅读次数:
230