Lattice paths

From the Project Euler

Problem 15:
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?


In the first attempt I counted all the possible paths but also taking advantage of some symmetries and routes already found, the computation time was too high.
This page helped me very much.
The algorithm that I wrote is more efficient and is also a good example of a recursive function.


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.