Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 08 · DSA · Worked problems, in English · about 18 min to read

Play it as a journeyTutor comes with a plan

Clinic #27: Jump Game

Pattern: Greedy · LC 55

Algorithm Design Patterns
Algorithm Design Patterns · Open board

Shows a catalog of five moves for attacking a problem. This clinic is the move called greedy (grab the best-looking choice now, never look back), used on a problem where that can be proven safe.

Before you start. Algorithm Design Patterns showed that “grab the best-looking choice and never look back” can be flatly wrong: with coins of 1, 3 and 4, grabbing the 4 first for an amount of 6 costs you a coin. Here you meet the same plan on a problem where it can never be wrong, and the whole skill is seeing why. The only other thing you need is a list: numbers in a row, each in a numbered slot starting from 0.

Lesson 66 of 96 in DSA

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • A river, five stones, and a number painted on each
  • By hand again: the stone with a zero on it
  • The wrong first idea: always take the longest stride
  • The click: reach, the furthest stone anyone could stand on
  • Greedy: one walk, one number, never look back
  • The tell: yes or no, and a maximum stride
  • Solution ladder
  • The greedy walked, printed
  • Timings (measured, 2026-09-27)
  • The same greedy, walked backwards
  • First time in an interview: the path
  • The greedy ladder: easy, medium, hard

Terms it explains: LC 55, stranded, brute force, reach, invariant, greedy, "Maximum", "Determine if", greedy reach, O(n), O(1), BEST, Draw two rivers, Code the six lines, Jump Game II, backtracking, constraint satisfaction, divide & conquer, dynamic programming, exchange argument, Master theorem, pruning, the meta-method.

Lab

Grabbing the biggest coin that fits gives the fewest coins with 1, 5, 10 and 25. Does it with any coins?

Pick 1, 3, 4 under The coins, set The amount to make to 6, and watch Coins greedy wasted.

Open The greedy bet

Review DSA