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.
You can check out the video solution by codechef
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.
1 1 1 1 1
4 4 4 4 4
1 2 2 2 1
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!