mirror of
https://github.com/devenperez/leetcode.git
synced 2026-06-13 14:57:08 +00:00
17 lines
670 B
Markdown
17 lines
670 B
Markdown
<h2><a href="https://leetcode.com/problems/generate-parentheses/">22. Generate Parentheses</a></h2><h3>Medium</h3><hr><div><p>Given <code>n</code> pairs of parentheses, write a function to <em>generate all combinations of well-formed parentheses</em>.</p>
|
|
|
|
<p> </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> </p>
|
|
<p><strong>Constraints:</strong></p>
|
|
|
|
<ul>
|
|
<li><code>1 <= n <= 8</code></li>
|
|
</ul>
|
|
</div> |