public int jump2(int[] A) {
        int len = A.length;
        int [] DP = new int[len];
        DP[0] = 0;
        for (int i = 1; i < len; ++i){
            int min = 1 << 30;
            for(int j = i-1; j>=0; --j){
                if (j + A[j] >= i){
                    min = Math.min(min, DP[j]+1);
                }
            }
            DP[i] = min;
            if(i+A[i] >= len - 1){
                return min+1;
            }
        }
        return DP[len-1];
    }