The problem is: 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: [
"((()))",
"(()())",
"(())()",
"()(())",
"()()()"
] The naive solution is to generate all combinations of N pairs of parentheses, then checking if each one is valid. The naive solution is implemented as follows: A better solution is to use backtracking. Instead of generation all combinations of N pairs