102. Minimum Jumps to the End
MediumGreedy
You start at index 0 of nums; from index i you may jump forward up to nums[i] positions. Return the minimum number of jumps needed to reach the last index. The last index is always reachable.
Example 1
Input: nums = [2, 3, 1, 1, 4] Output: 2 Explanation: Jump to index 1, then to the end.
Constraints
1 ≤ nums.length ≤ 10⁴0 ≤ nums[i] ≤ 1000