i am getting wrong output. please find the flaw in my code and how to correct it
Getting wrong output
-
use this condition before you pop the character from the stack. (checking if stack is empty or not before you pop will make sure you dont get a run-error if you try to pop from an empty stack) -
you did flag = 0, if the paranthesis were not balanced, so the condition should check if flag is still 1 or not
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.