Hi! I was solving question MANYCHEF and after reading it’s editorial where the question was solved while iterating from end to start of the string.I have done the same thing but i iterated from start to end.
I don’t know why my code is producing wrong answer. Please help. Why is my approach not working?
Here is link to question https://www.codechef.com/problems/MANYCHEF. Here is my solution https://www.codechef.com/viewsolution/14220313. Here is editorialist’s solution https://s3.amazonaws.com/codechef_shared/download/Solutions/COOK30/Setter/MANYCHEF.c