LeetCode - Given n pairs of parentheses,
write a function to generate all combinations of well-formed parentheses.
For example, given n = 3, a solution set is:
"((()))", "(()())", "(())()", "()(())", "()()()"
题解: 需要用dfs -backtracking.
给定的n为括号对,也就是有n个...
分类:
其他好文 时间:
2015-04-02 13:30:32
阅读次数:
158
No.22 Generate ParenthesesGivennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3,...
分类:
其他好文 时间:
2015-04-01 17:21:55
阅读次数:
97
Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given"25525511135",return["255.2...
分类:
其他好文 时间:
2015-04-01 15:10:21
阅读次数:
118
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
For example, given n = 3, a solution set is:
"((()))", "(()())", "(())()",
"()(())", "()()()...
分类:
其他好文 时间:
2015-04-01 11:25:47
阅读次数:
110
Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephon...
分类:
其他好文 时间:
2015-04-01 00:06:37
阅读次数:
119
题目链接:combinations
相似题型:
1. [LeetCode 39&40] Combination Sum I & II
2. [LeetCode 78] Subsets
3. [LeetCode 90] Subsets II
4. [LeetCode 22] Generate Parentheses
import java.util.A...
分类:
其他好文 时间:
2015-03-29 15:09:43
阅读次数:
153
Restore IP Addresses
Given a string containing only digits, restore it by returning all possible valid IP address combinations.
For example:
Given "25525511135",
return ["255.255.11.135", ...
分类:
其他好文 时间:
2015-03-28 23:20:39
阅读次数:
416
题目链接:generate-parentheses
import java.util.ArrayList;
import java.util.List;
/**
*
Given n pairs of parentheses, write a function to generate
all combinations of well-formed parentheses.
...
分类:
其他好文 时间:
2015-03-28 08:49:39
阅读次数:
105
Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution is:[ [2,4], [3,4], [2,3],...
分类:
其他好文 时间:
2015-03-22 00:28:37
阅读次数:
130
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 numb...
分类:
编程语言 时间:
2015-03-21 17:10:57
阅读次数:
193