Loading...
Loading...
Loading...
A cashier has unlimited notes of values 1, 2, 5, 10, 20, 50 and 100. Given an amount, print the smallest number of notes that add up to it.
Example 1
Input
289
Output
8
Example 2
Input
7
Output
2
Try the problem first. Open one hint at a time.
These note values let the largest note first rule work.
For each note from largest to smallest, add amount // note and keep amount % note.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor