```
public class Solution {
public int jump(int[] nums) {
int endIndex = nums.length-1;
int index = 0;
int steps = 0;
while (index < endIndex){
steps++;
int val = nums[index];
if (index+val >= endIndex){
break;
}
int maxForwardMomentum = 0;
int bestIndex = 0;
for (int i=1;i<=val;i++){
int _index = index+i;
int forwardMomentum = nums[_index]+_index;
if (forwardMomentum > maxForwardMomentum){
maxForwardMomentum = forwardMomentum;
bestIndex = _index;
}
}
index = bestIndex;
}
return steps;
}
}
```