why is it wrong for some testcases
💡 Balanced Parenthesis
Hey @17manishms
else if(str[i]==’)’|| str[i]==’}’ || str[i]==’]’)
{
if(s.empty())
{
count=1;
}
else{
s.pop();
}
}
The above part of your code is wrong. You need to make separate conditions for ‘}’, ‘]’ and ‘)’. Because ‘)’ will match with only ‘(’, ‘}’ will match with only ‘{’ and ‘[’ will match with only ‘]’. So you need to write the conditions separately. Do try and make this edit.
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.