面试题 08.09
Implement an algorithm to print all valid (e.g., properly opened and closed) combinations of n pairs of parentheses.
Note: The result set should not contain duplicated subsets.
For example, given n = 3, the result should be:
[ "((()))", "(()())", "(())()", "()(())", "()()()" ]
Solutions
The same as problem 22, check for more solutions.
dfs
Last updated
Was this helpful?