This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
countChange :: Int -> [Int] -> Int | |
countChange money coins = | |
let | |
applyFactors factors = (if (sum $ zipWith (*) coins factors) == money then 1 else 0) + | |
if all (== money) factors then 0 | |
else | |
applyFactors (nextFactors factors) | |
where | |
nextFactors (x : xs) | |
| x == money = 0 : (nextFactors xs) |
NewerOlder