curEnd
and curFar
to 0, and jumps
to 0.curFar
to be the maximum of curFar
and the sum of the current index i
and nums[i]
.i
is equal to curEnd
:
a. Increment jumps
as we need to make another jump.
b. Update curEnd
to curFar
.jumps
.