Saturday, March 26, 2011

Valid combinations of "N" pairs of round brackets

Write a method to print all the valid combinations of "N" pairs of round brackets.
Sample Input:
3
Sample output:
((()))
(()())
(())()
()(())
()()()


No comments:

Post a Comment