Loading problem…
This problem builds on valid-parentheses-iii. Complete that first, then load your solution to continue.
You're building a code generator that needs to generate all valid combinations of parentheses. This is useful for generating test cases, creating balanced expressions, or building parser test data.
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
generateParenthesis(3);
// ["((()))","(()())","(())()","()(())","()()()"]
generateParenthesis(1);
// ["()"]This problem models real code generation scenarios: