public int jump_greedy(int[] A) {

    int idx = 0;
    int jumpCount = 0;
    while (idx < A.length - 1) {
      int max = 0;
      int tempIdx = idx;
      for (int i = 0 ; i <= A[tempIdx] ; i++) {
        if (tempIdx + i < A.length) {
          if (i + A[tempIdx + i] > max && A[tempIdx + i] != 0) {
            max = i + A[tempIdx + i];
            idx = tempIdx + i;
          }
        } else {
          idx = A.length;
          break;
        }
      }
      // System.out.println(idx);
      jumpCount++;
    }

    return jumpCount;
  }