public int jump(int[] A) {
        if(A == null || A.length < 2) return 0;
        int start = 0, end = 0, step = 0;
        
        while(true) {
            step++;
            int max = start + A[start];
            for(int i = start+1; i <= end; i++) {
                if(i + A[i] > max) max = i + A[i];
            }
            if(max >= A.length - 1) return step;
            if(max <= end) return -1;
            start = end+1;
            end = max;
        }
    }