题意: iven n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: (Medium) [ "((()))", "(()())", "(())()", "()(())", "()()()…
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: [ "((()))", "(()())", "(())()", "()(())", "()()()" ] 给出 …
public class Solution { public IList<string> GenerateParenthesis(int n) { List<string> list = new List<string>(); backtrack(list, , , n); return list; } private void backtrack(List<String> list, String str, int open, int close, int…
题面 Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses 给定int n,代表n组括号,编码生成所有有效的括号组合(即符合括号嵌套规则) 样例 given n = 3, a solution set is: [ "((()))", "(()())", "(())()", "(…
本文始发于个人公众号:TechFlow,原创不易,求个关注 链接 Generate Parentheses 难度 Medium 描述 Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. 给定n对括号,要求返回所有这些括号组成的不同的合法的字符串 For example, given n = 3, a solution set is: [ "(…