22. Generate Parentheses
Practice Generate Parentheses for free on NudgeCode: Medium, Backtracking pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
Return every string made of n ( and n ) in which the parentheses are balanced (every ( is closed by a later )). The strings can be in any order.
Example
n = 2 -> ["(())","()()"]
Constraints
- 1 <= n <= 8