public static boolean canJump(int[] A) {//naive solution, TLE
        int len = A.length;
        int temp[] = new int[len+1];
        temp[0] = 1;
        for (int i = 0; i < len; ++i) {
        	if (A[i] == 0) continue;
        	else {
        		for (int j = i+1; j < len+1 && j <= i+A[i]; ++j) {
        			temp[j] = 1;
        		}
        	}
        }
        for (int i = 0; i < len+1; ++i) {
        	System.out.println(temp[i]);
        }
        if (temp[len] == 1) return true;
        else return false;
    }