#algo/depth-first-search #algo/breadth-first-search ## Notes Recursion + dfs / bfs should work. Use two queues, one is a queue of `(` and the other is queue of `)`. Every time you pop from queue 1, you can add to queue 2. ## Problem ### Problem Description Given $n$ pairs of parentheses, write a function to generate all combinations of well-formed parentheses. ### Examples #### Example 1 - **Input:** $n = 3$ - **Output:** `["((()))","(()())","(())()","()(())","()()()"]` #### Example 2 - **Input:** $n = 1$ - **Output:** `["()"]` ### Constraints - $1 \leq n \leq 8$