← back to unit
Medium
# breaking it down medium
Fewest Coins
The change machine hates jingling — it always pays with the FEWEST coins, using 25s, 10s, 5s, and 1s. 🪙
You get an amount. Print the fewest coins that make it. (Grab as many big coins as possible first — with these friendly coin sizes, that's always best.)
Example:
Input: amount = 67
Output: 6
Grabbing the biggest coins first — two 25s (50), one 10 (60), one 5 (65), two 1s (67) — uses 2 + 1 + 1 + 2 = 6 coins.
💡 need a hint?
brk-fewest-coins.py🔒 given lines are locked — write your code in between
loading...