MY code is giving correct output, but failing testcases

My code URL is :-https://ide.codingblocks.com/s/650565
plz check my code

Hello @chhabrarishi2001_264ecb7697e8af2a,

Your code is right, you just need to change the order of conditions like this,

if(open>close){
a[i]=’)’;
balancedParanthesis(a,i+1,open,close+1,n);
}

if(open<n){
a[i]=’(’;
balancedParanthesis(a,i+1,open+1,close,n);
}

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.