WorkspaceProblem lab
ALGORITHM VISUALIZER

Jump Game

Opening the interactive workspace…

Understanding Jump Game

Starting at index 0, return whether you can reach the final index. nums[i] is the maximum forward jump length from index i.

How it works

Only the farthest reachable index matters when deciding whether the next position is accessible.

Start with index zero reachable. Reject the first index beyond the reachable frontier. Extend the frontier using each reachable position.

Try an example

Input: nums = [2, 3, 1, 1, 4]

Output: true

Only the farthest reachable index matters when deciding whether the next position is accessible.

Constraints

  • 1–64 integers between 0 and 64.
  • You may choose any nonnegative jump length up to nums[i].

Use the simulator

Change the input, then choose Visualize input. Use Next and Previous to inspect each decision, or Play to advance automatically. Compare approaches and their complexity. Choose Try yourself to write JavaScript, select My code and Visualize code to inspect its execution, or Run Tests to check results.

Execution happens in your browser. Drafts are saved locally; avoid entering secrets or sensitive information.

Related concepts and complexity