MInimum Coins

3

2 votes
Mathematics, Algorithms
Problem

Ram has to pay Shyam R rupees and but the coins which he has got is of limited denomination .Assuming he has a limited knowledge of the mathematics and has unlimited number of coins of each denomination.Write a code to help Ram to pay the money using minimum number of coins .Suppose Ram has coins of {1,2} denomination then the best way to pay 8 rupees is 2+2+2+2 that means using 4 coins. Input: Money to be paid {array containing denominations available} Output Coins corresponding to each denomination and number of coins needed(ascending denomination) or print ERROR in other cases

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?