# Minimum Jumps to Reach the End

Let's solve the Minimum Jumps to Reach the End problem using Dynamic Programming.

## Statement

Given an array `nums`

of positive numbers, start from the first index and reach the last index with the minimum number of jumps, where a number at an index represents the maximum jump from that index.

For example, if the value at the current index is $3$, then a maximum of $3$ and a minimum of a $1$ step jump can be taken in the direction of the last index of the array. You cannot move in the opposite direction, that is, away from the last index.

Let’s say you have an array of $[2, 3, 1, 5, 7]$, starting from the $0^{th}$ index. It requires only two jumps to reach the last index. The first jump will be from the $0^{th}$ index to the $1^{st}$ index, i.e., only a one-step jump, and the next jump will be from the $1^{st}$ index to the $4^{th}$ index, i.e., a three-step jump.

**Constraints:**

- $1 \leq$
`nums.length`

$\leq 10^3$ - $0 \leq$
`nums[i]`

$\leq 10^3$ - It’s guaranteed that you can reach the last index of
`nums`

.

## Examples

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.