Index

Module 08 · DSAWorked problems, in English

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.

Continue reading with a plan

The first three lessons of every track are free. This lesson is included with a plan, which unlocks every lesson, board, video, lab and paper for one price.

View plans →Already a member? Sign in

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 →

Saved in this browser, and to your account when you sign in.