Skip to content

Instantly share code, notes, and snippets.

@lethain
Last active July 18, 2016 04:23
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 lethain/c1f48522a1a5d69c16bfc7c33a306f63 to your computer and use it in GitHub Desktop.
Save lethain/c1f48522a1a5d69c16bfc7c33a306f63 to your computer and use it in GitHub Desktop.
module Main (main) where
minOrZero lst = if null lst then 0 else minimum lst
coins 0 _ = 0
coins v ds = (1 + minOrZero [coins (v - d) ds | d <- ds, (v - d) >= 0])
main = do print "start"
print (coins 57 [1, 5, 10, 25])
print (coins 15 [1, 6, 9, 10])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment