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:
1 | [ |
递归来拼字符串;左括号的数量小于n时,可继续添加左括号;右括号的数量小于左括号时,可添加右括号
1 | class Solution { |
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:
1 | [ |
1 | class Solution { |