# 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.

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

DP O(n^2)

DP O(n)