Generate all Balanced Parentheses
Medium

Problem Statement

Given an integer N, generate all combinations of N pairs of well-formed (balanced) parentheses.

Examples

1Example 1
Input:
{ "n": 3 }
Output:
[ "((()))", "(()())", "(())()", "()(())", "()()()" ]
2Example 2
Input:
{ "n": 1 }
Output:
[ "()" ]
3Example 3
Input:
{ "n": 2 }
Output:
[ "(())", "()()" ]
Loading...

Sign in to Run Code and Submit