# Leetcode 45 - Jump game II

`Note:`

`DP`

(Slow)`dp[i]`

means the min steps from`index 0`

to`index i`

.- For each
`i`

we need to find the min dp value between`[0, i-1]`

and add`1`

to it.

`Greedy`

(Optimal)- How to be greedy? Always take next step that can
`go furthest from there`

.

- How to be greedy? Always take next step that can

Given an array of non-negative integers nums, you are initially positioned at the first index of the array.

Each element in the array represents your maximum jump length at that position.

Your goal is to reach the last index in the minimum number of jumps.

You can assume that you can always reach the last index.

**Example**

1 | Input: nums = [2,3,1,1,4] |

`DP O(n^2)`

1 | /** |

`DP O(n)`

1 | /** |