> For the complete documentation index, see [llms.txt](https://maksimdan.gitbook.io/interview-practice-problems/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://maksimdan.gitbook.io/interview-practice-problems/project_eular/15_lattice_paths.md).

# 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.

![](http://i.imgur.com/LZFubUc.png)

How many such routes are there through a 20×20 grid?

```
#include <iostream>
#include <limits>
#include <vector>

using namespace std;

void pause() { cin.ignore(numeric_limits<streamsize>::max(), '\n'); }

#define GRID 20

int main()
{
    long long int combinations = 1;
    for (int i = 0; i < GRID; i++)
    {
        combinations *= 2 * GRID - i;
        combinations /= i + 1; 
    }

    cout << combinations;
    pause();
}
```

Solution: 137846528820
