题目:
![](https://file.jishuzhan.net/article/1783760789446856705/53a60b6f2b689e5f19e725d3954de72b.webp)
题解:
python
class Solution:
def jump(self, nums: List[int]) -> int:
n = len(nums)
maxPos, end, step = 0, 0, 0
for i in range(n - 1):
if maxPos >= i:
maxPos = max(maxPos, i + nums[i])
if i == end:
end = maxPos
step += 1
return step