1def jump(nums):
2 jumps = 0
3 curr_end = 0
4 farthest = 0
5
6 for i in range(len(nums) - 1):
7 farthest = max(farthest, i + nums[i])
8
9 if i == curr_end:
10 jumps += 1
11 curr_end = farthest
12
13 return jumps