782. Parenthesis Generation
0
Medium
Given an integer 'n', generate all possible combinations of 'n' pairs of balanced parentheses. The output strings should be printed in ascending order, with '(' having a higher value than ')'.
Input Format
A single line containing an integer 'n'.
Output Format
Print the balanced parentheses strings, with each solution on a new line.
Example
Input
2
Output
()()
(())
Constraints
1<=n<=11
Loading...
View Submissions
Console