public int jump(int[] A) {
int sc = 0;
int e = 0;
int max = 0;
for(int i=0; i<A.length1; i++) {
max = Math.max(max, i+A[i]);
if( i == e ) {
sc++;
e = max;
}
}
return sc;
}
Single loop simple java solution

@timepass5 You can assume that you can always reach the last index. Please read the problem carefully.



Nice solution. But I wrote in this way. Check my explanation.
public static int jump(int[] A) { int currLong = 0, nextLong = 0, level = 0; for (int i = 0; i < A.length; i++) { if (i  1 == currLong) { level++; currLong = nextLong; } nextLong = Math.max(nextLong, A[i] + i); } return level; }

