LeetCode - 150 - Generate Parentheses
The problem Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Examples Input: n = 3 Output: ["((()))","(()())","(())()","()(())","()()()"] Input: n = 1 Output: ["()"] Constraints 1 <= n <= 8 Explanation Before we jump to the solution, let’s figure out what well-formed parentheses mean. In this problem, this means when you’re writing the code using nested parentheses, you want them to be nested in a valid way, like (()()). ...