Help related to LUNCHTIM - Question in Lunchtime March21

https://www.codechef.com/viewsolution/44351010

I tried to debug this solution on every possible combination I can make. Still got WA for the submission.

The question can be easily solved using Stack, but I need help with this solution.

My approach is explained line by line in the solution.

Thank you!

You can check out the video solution by codechef

1 Like

Thanks for this. I have already seen it and my code works fine even for the test case in the video.

But I need help with the solution I wrote!

Your code is failing in the following test case.
Input

1
5
1 1 1 1 1

Expected Output

4 4 4 4 4

Your Output

1 2 2 2 1
1 Like

Yes, i just figured it out a min ago. Thank you!

Actually I didn’t understood the question properly and was missing the equal height logic!

1 Like