Unable to solve COMPILER problem

Hi, I have been trying to solve the COMPILER problem. I am using the string as an array instead of using stack and queue. I have a suspicion that the reason my code is not working is because of else if condition in line 28. I could be wrong though.

Problem link here: https://www.codechef.com/LRNDSA02/problems/COMPILER
Solution link here: https://www.codechef.com/viewsolution/33231067

Thanks for the help guys :slight_smile:

1 Like

Thanks a lot!

1 Like


II tried solving it again but it is still giving a WA. I am getting the correct answer for << , <<> etc. Please help me regarding the same. Also, would love to know how to debug/generate test cases for the same. Do we need to think about every test case or is there some better way?

Problem link : https://www.codechef.com/LRNDSA02/problems/COMPILER
Solution link: https://www.codechef.com/viewsolution/33252439

Thanks for the help!
Sidhant Dhar

Consider the test input:


I just generated an exhaustive list of all expressions with length \le 16 or so, along with the correct answer for each one.

1 Like