public static int jumpHelper(int cur, int[] A, int[] eachMinJump) {
        if(cur==A.length-1) return 0;
        else
            if(A[cur]<=0) return Integer.MAX_VALUE;
            else
                if(A[cur]>=(A.length-1-cur)) return eachMinJump[cur]=1;
                else {
                    for(int i=1;i<A.length-1-cur;i++) {
                        if(eachMinJump[cur+i]==Integer.MAX_VALUE) eachMinJump[cur+i] = jumpHelper(cur+i, A, eachMinJump);
                        eachMinJump[cur] = Math.min(eachMinJump[cur], eachMinJump[cur+i]+1);
                    }
                    return eachMinJump[cur];
                }
    }