- 1
Commit and Never Look Back
Greedy commits to the locally best choice with zero undo — safe exactly when an exchange argument holds.
Multiple choice - 2
Assign Cookies
Sort children and cookies, then give each child the SMALLEST cookie that satisfies them — greedy's classic exchange argument.
Complete codeMultiple choiceTrace - 3
Lemonade Change
Count your $5s and $10s; for a $20, spend the less flexible $10 first — versatile bills are worth hoarding.
Complete codeDebugMultiple choiceTrace - 4
Stock Trading, Greedily
Sum every positive day-to-day rise — any profitable multi-day hold telescopes into exactly those rises, so grabbing each one is provably optimal.
Complete codeMultiple choiceTrace - 5
Jump Game
One sweep, one number: the furthest reachable index. Extend it at every reachable position, and dead-stop the moment i outruns it.
Complete codeDebugMultiple choiceTrace - 6
Partition Labels
Map each letter to its last occurrence, sweep while extending end = max(end, last[c]), and cut the instant i == end — the earliest legal cut is always safe.
Complete codeDebugMultiple choiceTrace - 7
Greedy CheckpointCheckpoint
No new concepts — transfer the island's greedy moves to unseen problems: pairing boat passengers, loading a truck by value, splitting people across two cities, and counting wiggle direction flips.
Code orderMultiple choiceTrace - 8
Greedy ReviewReview
Mixed recap of the island: the exchange argument as greedy's proof obligation, sort-first setup, greedy vs backtracking vs DP, the coin counterexample, one-pass state sweeps, and sort-dominated cost vs exponential search.
Complete codeMultiple choice - 9
Boss: Gas StationBoss
The island's final test: circle the stations once. Total net fuel decides solvability; one pass with a restarting tank finds the unique start — and the boss's trap is restarting at the failed station instead of after it.
Complete codeDebugCode orderMultiple choiceTrace
Backtracking & Greedy is part of AlgoFox Pro
You can read the whole course outline here. The exercises are in the app, along with your streak, your mistake review, and the progress that carries across your devices.
Pro starts with a 3 day free trial. The app store decides who is eligible for an introductory offer, and a lapsed subscription does not get another one.
Already subscribed in the app? Sign in with the same account and Pro works here too. Quick Play and Battle are free on the web, and so is the first course in every subject.
