Python Parenthesis Problem Output Doubt

I want to know the output for n=3.
My output is
((()))
(()())
(())()
()(())
()()()

hey you might have done
if openbrackets>0 first and then closebrackets constraint. just reverse the order

1 Like