What is wrong with my code?

Giving correct ans for n=2 and n=3 but giving wa on submitting
Link to code-> https://ide.codingblocks.com/s/644856

hi @ikshuldureja130
lets consider for n = 3…

expected o/p-->
((()))
(()())
(())()
()(())
()()()

ur o/p -->
()()()
()(())
(())()
(()())
((()))

see ur logic is correct, just the order in which o/p should be printed is not matching… so just move the lower if statement above in code…
also since u are using string s+=’\0’; don’t do this, as this is needed in case of character arrays…

corrected code, it s passing all test cases now–>

hi @ikshuldureja130
i hope its clear now… and pls reply krdiya kro if u still face any difficulty…

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.