public boolean canJump(int[] A) {
        if (A.length == 0) return false;
        if (A.length == 1) return true;
        int max = A[0];
        int cur = 0;
        while (max < A.length - 1) {
            if (cur == max && A[max] == 0) return false;
            else {
                max = cur + A[cur] > max ? cur + A[cur] : max;
            }
            cur++;
        }

        return true;
    }