wrong ans in DIGIT JUMP

Why this code (http://ideone.com/p0KN5v)is giving wrong ans.Can someone give a test case which fails this solution??

Hey, for this case(given in editorial page) :


answer is 5,but your’s is 6

Correct way:

index1(7) -> index10(7) -> index9(5) -> index7(5) -> index6(6) -> index16(6)

please detect problem in my code also its not working plz tell the mistake its working for your test cases posted here and on editorial

plz ive tried a lot and i am fedup why i am getting WA