Skip to main content
mediumBlind 75

Jump Game

Given an array where nums[i] = max jump length at position i Return true if you can reach the last index starting from index 0 Example: [2,3,1,1,4] => true (jump 1 step from 0 to 1, then 3 steps to last)

Jump Game is about turning repeated work into a reusable state instead of re-solving subproblems. Interviewers love it because it reveals your state-and-transition thinking and your edge-case discipline. Once you define the right state, the transitions usually write themselves.

Examples

You write

can_jump(nums: List[int])

  1. Example 1

    Input
    nums = [2,3,1,1,4]
    returns
    true
  2. Example 2

    Input
    nums = [3,2,1,0,4]
    returns
    false

The pattern behind it

Arrays & Hashing

I reach for it when

  • You catch yourself scanning the array again for every element.
  • The problem asks about duplicates, pairs, counts or groups.

Say this before you type. Say what the key is and what the value remembers, before you write the loop.

All 127 Arrays & Hashing problems

Dynamic Programming

I reach for it when

  • Brute force repeats the same subproblem.
  • You are asked for a count, a minimum or a maximum.

Say this before you type. Say the state in one sentence, then say which smaller states it reads from.

All 37 Dynamic Programming problems

Meet Coco

Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Sign in free to type with Coco, up to a daily limit. The editor and Run stay open without an account. Anyone can open the editor and run their code.

1Can Jump to Last Indexmedium

Prep guides that list this problem

Our company tags come from public interview write-ups. None of these is a confirmed question.