# Euler 0015

### The Problem:

How many paths can you take if you just walk through a grid by only moving down and right?  
We are looking for 20x20. 2x2 has a given value of 6.

### Considerations:

As it turns out, this is just the max value of all the odd layers of pascal's triangle.   
1   
1 1   
1 2 1   
1 3 3 1   
1 4 6 4 1

### The Approach:

So if we generate 41 rows of pascal then we can take the max value and that is the answer.

<div class="md-output__section has-scroll" id="bkmrk-keep-iterating-throu"></div>### The Code:

<details id="bkmrk-target_under-%3D-1000-"><summary></summary>

```python
pascal_rows = 41

def generate_pascals_last_row(rows):
    last_row = [1]
    #we have already generated row 1
    for i in range(rows-1):
        #take the first number (hint, it's 1)
        current_row = [1]

        #add up all the numbers and put them in between
        for j in range(0, len(last_row) - 1):
            current_row += [last_row[j] + last_row[j+1]]

        #take the last number (hint, it's 1)
        current_row += [1]
        last_row = current_row 
    
    return last_row

print(max(generate_pascals_last_row(pascal_rows)))

```

</details>