I tried many times and the solution is working in my IDE but it doesn’t work in codechef.
This is the first solution :
The above solution was partially correct and i was getting TLE on subtasks. So i tried following
This solution is giving me NZEC.
This is frustrating, i am trying this question from 3 days now still with no success. I am discouraged to continue further on platform.
Any help or suggestions will be appreciated, i am aim to have good command over DS & Algos. This question was the starting point for me.