Coin change (fewest coins)
Fewest coins for every amount from 0 up: each amount is one coin more than some smaller amount.
Coins1, 3, 4make 6
Coins 1, 3, 4. dp[a] = fewest coins that make a. Zero coins make 0; everything else starts at ∞.
Fewest coins for amounts 0 to 6: 0, ∞, ∞, ∞, ∞, ∞, ∞.
- compare
- swap or write
- settled
Space play · ← → step · Home End jump · drag the strip to scrub