public static int jump(int[] A) {
        if(A.length == 1) return 0;
        int max = 0, count = 0, start = 0, end = 0;
        while(end < A.length){
            count++;
            for(int i = start; i <= end; i++){
                if(i + A[i] >= A.length - 1) return count;
                max = i + A[i] > max ? i + A[i] : max;
            }
            start = end + 1;
            end = max;
        }
        return 0;
    }