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:
"((()))", "(()())", "(())()",
"()(())", "()()()"
本文介绍了一个生成有效括号组合的算法。给定一个正整数 n,该算法能生成所有可能的有效括号字符串。例如当 n = 3 时,可以生成 ((()))、(()())、(())()、()(()) 和 ()()() 等有效括号组合。
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:
"((()))", "(()())", "(())()",
"()(())", "()()()"

被折叠的 条评论
为什么被折叠?