
枚举(求All)
不刷脸皮要刷题
这个作者很懒,什么都没留下…
展开
-
Letter Combinations of a Phone number
先把digit-letter建个Given a digit string, return all possible letter combinations that the number could represent.转载 2014-11-12 00:06:30 · 326 阅读 · 0 评论 -
Combination Sum I, II
public class Solution { public List> combinationSum(int[] candidates, int target) { if (candidates == null || candidates.length == 0) { return null; } Arrays.so转载 2014-11-11 23:48:00 · 252 阅读 · 0 评论 -
Word Break II
枚举的题,一般用DFS+Backtracking做,此题会超时,那么要辅助memoization, 保存之前得到的结果.怎么mem?1,借鉴word break I, 保存能否该index之后能否break: boolean[s.length() + 1]2, 保存详细的分法结果: HashMap>public class Solution { List res =转载 2014-10-04 03:19:24 · 391 阅读 · 0 评论 -
Combinations
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4],]转载 2014-10-09 12:26:47 · 318 阅读 · 0 评论 -
Subsets I, II
DFS + BacktrackingII是考虑原set中有重复元素的情况Subset ISubset I转载 2014-10-19 21:02:17 · 346 阅读 · 0 评论