Skip to content

Instantly share code, notes, and snippets.

@vlas-ilya
Created October 7, 2015 13:36
Show Gist options
  • Save vlas-ilya/a79efd9ff8cca3c3f35c to your computer and use it in GitHub Desktop.
Save vlas-ilya/a79efd9ff8cca3c3f35c to your computer and use it in GitHub Desktop.
change n | n < minimum coins = [[]]
| otherwise = [xs | x <- coins,
x <= n,
xs <- map (\ys -> x:ys) $ change (n - x),
sum xs == n]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment