Unable to clear case 1 and 2

In case 1 and 2 I’m getting the runtime error, please check my code.

@satyendra4030
Consider such testcases where string starts with ‘)’ . For example
“)()”
your code give segmentation fault here because for element at index 0, your code check for stk.top() (as in line 26) but stack is empty and don’t have stk.top()

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.