[Haskell-cafe] Coin changing algorithm

Dinh Tien Tuan Anh tuananhbirm at hotmail.com
Wed Jul 13 09:22:31 EDT 2005

The problem is:
Given an amount of money m, and unlimited coins of value 1p, 2p, 5p, 10p, 
20p, 50p, £1 and £2
List ALL (distinct) ways  of change for m, using no greater than k coins

eg: m = 75, k = 5
     =>   [50, 20, 5]
             [50, 20, 1,2,2]

i have been familiar with the "integer parition" problem, but how to 
generalise to solve the one above ?

Is this problem suitable for functional programming language ?

Any idea ?

It's fast, it's easy and it's free. Get MSN Messenger 7.0 today! 

More information about the Haskell-Cafe mailing list