Project Euler #15: Lattice Paths

Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner.
How many such routes are there through a 20×20 grid?

This problem is solvable via combinatorics; since you are only able to move to the right and upwards along the graph, you have all possible permutations of twenty ups along the graph, and twenty rights. Divide by 20! to account for the redundancies that occurred while traversing.

(40!/20!)/20! = 137846528820

Leave a Reply

Your email address will not be published. Required fields are marked *