Jump Game II
You are given a 0-indexed integer array nums of length n. Each element nums[i] represents the maximum jump length from that position.
Initially, you are positioned at the first index of the array.
Return the minimum number of jumps required to reach the last index.
You can assume that the last index is always reachable.
Example 1
Input
5 2 3 1 1 4
Output
2
Explanation
Jump from index 0 to index 1, then jump from index 1 to the last index.
The minimum number of jumps required is 2.
Example 2
Input
5 2 3 0 1 4
Output
2
Explanation
Jump from index 0 to index 1, then jump directly to the last index.
Only 2 jumps are required.
Constraints
Hints:
Hint 1
Think of each jump as expanding the range of indices that can be reached.
Hint 2
Track the farthest index reachable within the current jump range. When you reach the end of the current range, increase the jump count and extend the range to the farthest reachable index.
Author & Technical Reviewer
Technically reviewed by: ExamAdda Technical Review Team
Technical Reviewers, ExamAdda
Software engineers at ExamAdda who check every article's definitions, complexity claims and code examples before and after publishing.
Published
Aug 4, 2026
Last updated
Aug 4, 2026
Content Verification Methodology
Definitions and complexity claims were checked against authoritative computer-science references. Code examples were compiled and tested with standard, boundary and edge-case inputs.
Expected Output