Symbol(clack:cancel)
This commit is contained in:
21
solutions/0000_0029/0015.gridpath/eular_15.py
Normal file
21
solutions/0000_0029/0015.gridpath/eular_15.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""
|
||||
Starting in the top left corner of a 2 X 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 X 20 grid?
|
||||
"""
|
||||
|
||||
import math
|
||||
|
||||
|
||||
def grid_paths(m: int, n: int) -> int:
|
||||
return math.comb(m + n, m)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
print(grid_paths(20, 20))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user