Generate parentheses
Mediumbacktrackingrecursionstring
Return every well-formed arrangement of n pairs of parentheses (). The order of the answers doesn't matter.
Example 1
Input: n = 3 Output: ["((()))","(()())","(())()","()(())","()()()"]
Example 2
Input: n = 1 Output: ["()"]
Constraints
- 1 ≤ n ≤ 8
Submit checks your solution against 7 tests, including hidden ones.
/**
* @param {int} n
* @return {string[]}
*/
function generateParenthesis(n) {
}