Codechef april long challenge problem (REBIT)

Hey I was trying this problem. But my code is giving Run time error which I am

to figure out. Can somebody please help see my code where it is giving run time error(SIGSEGV).
problem : https://www.codechef.com/APRIL20B/problems/REBIT

submission : https://www.codechef.com/viewsolution/32204225

Can you please provide a link to your submission?

submission : https://www.codechef.com/viewsolution/32204225

thanks for responding!

Hey @akshatb622 I think you have declared the vector in line 105 and you are accessing v[0] without resizing it, remember it’s a vector not an array.

Try printing the size of the stack after the loop, it outputs 0.

I don’t get how your logic works. You’re not supposed to pop from the stack when the value is not # since it can be (, ), or one of &^|.

You should keep a variable sign and update it whenever you encounter a sign. And only pop when you encounter )