Greedy Coins
Using US coins worth 25, 10, 5 and 1 cents (as many of each as you need), return the smallest number of coins that add up to exactly cents.
Example 1
cents 41
returns 4
25 + 10 + 5 + 1 = 4 coins.
Constraints
0 <= cents <= 1000
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Greedy problems
- Least Total Waiting TimeBeginner
- Most Tasks in a Time BudgetBeginner
- Only the Best CountBeginner
- Shortest Walk to SeatsBeginner
- Stepping StonesBeginner
- Third One FreeBeginner
- Two Numbers From Four DigitsBeginner
- Array PartitionEasy