Skip to content

Commit

Permalink
Finished 15 a while ago, but for some reason I was missing the file.
Browse files Browse the repository at this point in the history
  • Loading branch information
atnan committed Jan 30, 2009
1 parent e7c6a93 commit 94db8b3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions 015.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Problem 15:
# Starting in the top left corner of a 2x2 grid, there are 6 routes (without
# backtracking) to the bottom right corner. How many routes are there through a
# 20x20 grid?

require 'lib/factorial'

grid_size = 20
central_binomial_coefficient = (2 * grid_size).factorial / grid_size.factorial ** 2

puts central_binomial_coefficient

# Answer: 137846528820
# Time: 0m0.010s

0 comments on commit 94db8b3

Please sign in to comment.