The available coins and notes are worth 1, 2, 5, 10, 20, 50, 100, 500, 2000, with as many of each as you like. Return the fewest coins and notes that add up to exactly amount.
For amount = 70 the answer is 2 (50 + 20); for amount = 121 it is 3 (100 + 20 + 1).
Example 1
Input:
fewest_notes(70)
Output:
2
Example 2
Input:
fewest_notes(121)
Output:
3
0 <= amount <= 10**12No results yet
Run your code to check it against the examples, or submit to run every test.