MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / lattice_paths

Function lattice_paths

project_euler/problem_15/sol1.py:4–8  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

2from math import factorial
3
4def lattice_paths(n):
5 n = 2*n #middle entry of odd rows starting at row 3 is the solution for n = 1, 2, 3,...
6 k = n/2
7
8 return factorial(n)/(factorial(k)*factorial(n-k))
9
10if __name__ == '__main__':
11 import sys

Callers 1

sol1.pyFile · 0.85

Calls 1

factorialFunction · 0.50

Tested by

no test coverage detected