图片说明
https://www.bilibili.com/video/av64486080/?spm_id_from=333.788.videocard.1
https://www.bilibili.com/video/av55631531/?spm_id_from=333.788.videocard.0
两种解法一样 第二个讲得比较清晰

class Solution {
  public int jump(int[] nums) {
        int ans = 0;
        int len = nums.length;
        if(len == 0 )return 0;
        int left = 0 ;
        int right= 0 ;
        for(int i = 0 ; i < len - 1 ; i ++) {  
            right = Math.max(right , i + nums[i]);  //选最大的距离是多少
            if(i == left ) { //到达极限的只能再走一步
                left = right;
                ans++;
            }
        }
        return ans;
    }     
}