
回溯法
文章平均质量分 83
Yadoer
这个作者很懒,什么都没留下…
展开
-
LeetCode-Palindrome Partitioning
Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return [ ["aa","原创 2015-02-09 20:28:12 · 1036 阅读 · 0 评论 -
回溯法-求全排列
回溯法入门,求一个集合的全排列,比如{2,3,5}的全排列为:[[2, 3, 5], [2, 5, 3], [3, 2, 5], [3, 5, 2], [5, 3, 2], [5, 2, 3]]代码如下:public class AllPermutations { public void allPermutations(List> lists, Integer[] a, int cur)原创 2015-02-09 20:25:47 · 1474 阅读 · 0 评论 -
LeetCode-Word Break II
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet"原创 2015-03-13 20:56:46 · 1076 阅读 · 0 评论 -
LeetCode-Subsets(子集)
三种不同的方式,生产一个集合的所有子集,回溯法、迭代法。。。原创 2015-02-09 20:22:49 · 1116 阅读 · 0 评论