Jump Game Problem Overview
The "Jump Game" refers to LeetCode problem 55, a popular Amazon interview question tagged with Array, Greedy, and Dynamic Programming. It asks if you can reach the last index of a given array of non-negative integers, where each element nums[i] represents the maximum jump length from index i.[1][3]
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. Determine if you are able to reach the last index.
Return true if you can reach the last index, or false otherwise.[2][3][4]
| Example | Input | Output | Explanation | |---------|-------|--------|-------------| | 1 | nums = [2][3][1][1][4] | true | Can jump from index 0 (up to 2 steps) to 1, then from 1 (up to 3 steps) directly to the last index. [3][4] | | 2 | nums = [3][2][1][4] | false | Stuck at index 3 (value 0); cannot jump to index 4 despite earlier reachability. [3][4] | | 3 | nums = | true | Single element at last index; no jump needed. [3] | | 4 | nums = [2] | true | Jump from 0 to end (if length allows); edge case for exact reach. [3] |