Suppose in an infinitely long line, the tortoise is standing in position 0.
From that place, it can move in both +ve and -ve direction. The condition is that, in i-th jump, it can move i step forward or backward.
So one possible scenario can be -
0 [i=1] --- 1 step forward 1 [i=2] --- 2 step forward 3 [i=3] --- 3 step forward 6 [i=4] --- 4 step backward 2 [i=5] --- 5 step forward 7 [i=6] --- 6 step backward 1 [i=7] --- 7 step forward 8
If you look carefully, you'll find that -- If the tortoise moves this way, it'll always be able to reach any destination (x).
The question is what is the minimum number of moves it'll take to reach destination x.
For example --
if x=8 >> in the above example, it takes 7 steps >> but if it moves this way -- [0,-1,1,4,8] -- steps required = 4.
So 4 is the optimum way.