<p>Given <code>n</code> pairs of parentheses, write a function to <em>generate all combinations of well-formed parentheses</em>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre><strong>Input:</strong> n = 3
<strong>Output:</strong> ["((()))","(()())","(())()","()(())","()()()"]
</pre><p><strong class="example">Example 2:</strong></p>
<pre><strong>Input:</strong> n = 1
<strong>Output:</strong> ["()"]
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= n &lt;= 8</code></li>
</ul>

def parenthesis(s, op, cl, ans):
    if op == 0 and cl == 0:
        ans.append(s)
    if op != 0:
        parenthesis(s+'(', op-1, cl, ans)
    if cl > op:
        parenthesis(s+')', op, cl-1, ans)

class Solution:
    def generateParenthesis(self, n: int) -> List[str]:
        ans = []
        parenthesis('', n, n, ans)
        return ans
16500