Balanced parenthesis (half test cases passed)


i am able to pass 50% of the test cases.
I am not able to figure out where is the problem as i have checked almost all the constraints. please help

AND ALSO I HAVE QUESTION:: IS “( [ ) ]” A BALANCED STRING??

@anishmittal
hello Anish,
In line no 43,
image

it should be if( flag==1 || ! a.empty())

that string( u asked in question) is not valid

https://ide.codingblocks.com/s/124972 The code still node passing all test cases

@anishmittal
image

u cannot compare like this,
it should be if(s[i]==’(’ || s[i]==’{’ || s[i]==’[’)

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.