Generate Parentheses

Medium
Strings Backtracking
Solve the Generate Parentheses problem. Input and output as shown in examples.

Constraints

See problem-specific constraints.

Examples

Example 1:
Input: 3
Output:
Example 2:
Input: 3
Output:

Hints

Think about the approach carefully.
Consider edge cases.
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.