Generate Parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
Example 1
Input
n = 3Output
["((()))","(()())","(())()","()(())","()()()"]There are five distinct well-formed combinations using three pairs of parentheses.
Example 2
Input
n = 1Output
["()"]With one pair of parentheses, the only valid combination is
().Constraints
- 1 <= n <= 8