Generate all Combinations of Balanced Parentheses

Generate all combinations of balanced parentheses for the n number of parentheses pairs.

Statement

Write a function to generate all balanced combinations of nn pairs of parentheses.

Example

Here are a few examples:

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.