about | help | code help+videos | done | prefs |
Make change optimally(this problem can't be solved with a greedy approach) Input: The array contains denominations of the coins you have available, paid is what the customer paid, and worth is what the item is worth. The customer will always pay more than what the item is worth. Output: Output the minimum number of coins you need to make change with the coins you have available. makeChange([1, 3, 5, 6], 50, 39) → 2 makeChange([1, 10, 20], 54, 50) → 4 makeChange([5, 10, 25], 75, 45) → 2 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 400 Post-solution available
Copyright Nick Parlante 2017 - privacy