Code not working

your approach is not correct
FOR INPUT
1
15
your output is 8
but correct output is 4

first take jump of 8 then jump of 4 then jump of 2 then jump of 1
0->8->12->14->15
total jumps=4

Correct Code