```
public int jump(int[] nums) {
int[] dp = new int[nums.length];
for(int i = 0, j = 1; i < nums.length && j < nums.length; ++i) {
int end = Math.min(nums.length - 1, nums[i] + i);
while(j <= end)
dp[j ++] = dp[i] + 1;
}
return dp[nums.length - 1];
}
```