Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- countExchanges :: (Integral a) => a -> [a] -> a
- countExchanges sum coins
- | sum == 0 = 1
- | sum < 0 || null coins = 0
- | otherwise = countExchanges (sum - head coins) coins +
- countExchanges sum (tail coins)
- main = print (countExchanges 100 [50, 25, 10, 5, 1])
Add Comment
Please, Sign In to add comment