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:
"((()))", "(()())", "(())()", "()(())", "()()()"
"((()))", "(()())", "(())()", "()(())", "()()()"
"25525511135"
,["255.255.11.135", "255.255.111.35"]
. (Order does not matter)"aab"
,[ ["aa","b"], ["a","a","b"] ]
0-9
only, each root-to-leaf path could represent a number.1->2->3
which represents the number 123
.1 / \ 2 3
1->2
represents the number 12
.1->3
represents the number 13
.25
.sum = 22
,5 / \ 4 8 / / \ 11 13 4 / \ / \ 7 2 5 1return
[ [5,4,11,2], [5,8,4,5] ]
10,1,2,7,6,1,5
and target 8
, [1, 7]
[1, 2, 5]
[2, 6]
[1, 1, 6]
2,3,6,7
and target 7
, [7]
[2, 2, 3]
Input:Digit string "23" Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"].
[1,2,2]
, a solution is:[ [2], [1], [1,2,2], [2,2], [1,2], [] ]
[1,2,3]
, a solution is:[ [3], [1], [2], [1,2,3], [1,3], [2,3], [1,2], [] ]
[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4], ]