Skip to content

Instantly share code, notes, and snippets.

@2GMon
Created August 6, 2012 00:56
Show Gist options
  • Save 2GMon/3268684 to your computer and use it in GitHub Desktop.
Save 2GMon/3268684 to your computer and use it in GitHub Desktop.
-- Project Euler : Problem 15
combination :: Integer -> Integer -> Integer
combination n m = product [n,n-1..(n - m + 1)] `div` product [1..m]
numRoutes :: Integer -> Integer -> Integer
numRoutes x y = combination (x + y) $ min x y
main = print $ numRoutes 20 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment