摘要:
原题 给定一个含不同整数的集合,返回其所有的子集 如果 S = [1,2,3],有如下的解: 子集中的元素排列必须是非降序的,解集必须不包含重复的子集 解题思路 Backtracking, DFS 数组要排序,接着一层一层的递归,每一层列表的元素个数加一 完整代码 阅读全文
posted @ 2017-03-27 11:33
小丑进场
阅读(143)
评论(0)
推荐(0)
摘要:
http://www.lintcode.com/zh-cn/problem/generate-parentheses/ 原题 给定 n 对括号,请写一个函数以将其生成新的括号组合,并返回所有组合结果。 样例 给定 n = 3, 可生成的组合如下: "((()))", "(()())", "(())( 阅读全文
posted @ 2017-03-27 09:57
小丑进场
阅读(174)
评论(0)
推荐(0)
摘要:
原题 Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. 解题思路 代码实现 阅读全文
posted @ 2017-03-27 09:36
小丑进场
阅读(218)
评论(0)
推荐(0)

浙公网安备 33010602011771号