~/boss / fewest-coins
Coin change (dynamic programming)
The Coin Fight
Pay exactly 6 gold in the fewest coins. Greedy says 3. Beat it.
Loading the fight…
How to beat it
Greedy grabs the biggest coin that fits, and loses. Instead, fill a table of the fewest coins for every amount from 0 up. For each amount, try every coin: 1 + the fewest for what's left. The last cell is the answer; follow the coins back to pay it.
Now the real boss
Interviews ask for the code. Watch it run, then write it yourself, tested in Python, C++ or Java.
On your phone? Writing code is easier on a laptop: open bossfight.dev/problems/coin-change there. Sign in with your email to keep your progress on every device.