You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{-Starting in the top left corner of a 22 grid, there are 6 routes (without backtracking) to the bottom right corner. How many routes are there through a 2020 grid?-}
factorial x = if x > 0 then product [1..x] else 0
-- | compute number of routes through a x*y rectangle
noOfRoutes :: Integer -> Integer -> Integer
noOfRoutes x y = (factorial (x + y)) `div` ((factorial x) * (factorial y))