You are given a 0-indexed array of integers nums of length n. Each element nums[i] represents the maximum length of a forward jump from index i. You are initially positioned at nums[0], and you must determine the minimum number of jumps needed to reach nums[n - 1]. It is guaranteed that you can reach the last index.
Click Run to execute sample tests.