Skip to content

Instantly share code, notes, and snippets.

@Ummon
Created September 20, 2012 09:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ummon/3754848 to your computer and use it in GitHub Desktop.
Save Ummon/3754848 to your computer and use it in GitHub Desktop.
Haskell > Scala (2)
countChange :: Int -> [Int] -> Int
countChange 0 _ = 1
countChange _ [] = 0
countChange money coins@(x:xs)
| money < 0 = 0
| otherwise = (countChange money xs) + (countChange (money - x) coins)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment