SPOJ:Street Parade

I was solving the Street Parade from SPOJ and here’s my SOLUTION. After getting a ‘no’ ans the program’s outputs all are changed to ‘no’,but I’m using a bool variable. For the same testcase it shows ‘yes’ (before any ‘no’ testcase) and again ‘no’(after getting ‘no’ testcase).

Please help out. Thanks. :slight_smile:

I think the problem with your code is that you are not clearing the stack after each iteration…clearing the stack should solve your problem…LINK…hope this helps :slight_smile:

thanks. :slight_smile:

//