Question: Write a function to find the minimum number of coins needed to make a given amount of money. The function should take in a list
Write a function to find the minimum number of coins needed to make a given amount of money. The function should take in a list of available coin denominations and the amount of money, and return the minimum number of coins needed. The function should first sort the coin denominations in decreasing order and then use dynamic programming to solve the problem.
Example:
Input:
denominations = [1, 5, 10, 25]
amount = 41
Output: 6
Explanation: The minimum number of coins needed to make 41 cents is 6, using one 25-cent coin, one 10-cent coin, and one 5-cent coin, and one 1-cent coin.
Step by Step Solution
3.33 Rating (147 Votes )
There are 3 Steps involved in it
The detailed ... View full answer
Get step-by-step solutions from verified subject matter experts
