Help in hit the coconut question

question :

my code- CodeChef: Practical coding for everyone
one of testcase is time limit exceeding inspite of n*z time complexity.Can anyone please help me to optimize my code.

2 Likes