Jump game minimum jumps
Your task
You are given an array where nums[i] is the maximum forward jump length from index i. Starting at index 0, return the minimum number of jumps needed to reach the last index. It is guaranteed the last index is reachable. Constraints: 1 <= n <= 10^4, 0 <= nums[i] <= 1000.
Examples
min_jumps(nums: list[int]) -> intExample 1
Input
min_jumps([2, 3, 1, 1, 4])Output
2