Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
A well-formed (valid) parentheses string has:
The backtracking approach: at each position, we can add '(' if we haven't used all n, or add ')' if the number of ')' is less than the number of '('.
The total number of valid combinations is the nth Catalan number: C(2n,n)/(n+1).
n = 3["((()))","(()())","(())()","()(())","()()()"]n = 1["()"]1 <= n <= 8Click "Run" to execute your code against test cases
Socratic guidance - I'll ask questions, not give answers