class Solution:
    def jump(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        n=len(nums)
        if n<=1:
            return 0
        res,left,right,max_index=0,0,0,0
        while max_index<n-1:
            res+=1
            min_index=max_index+1
            for i in range(left,right+1,1):
                max_index=max(max_index,i+nums[i])
            left=min_index
            right=max_index
        return res