Last active
May 21, 2021 15:45
-
-
Save rdisipio/d840a74b2e815e26d032280f6e3a6d0f to your computer and use it in GitHub Desktop.
Chessboard exploration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
m = 3 | |
n = 4 | |
S = [[None for _ in range(n+1)] for _ in range(m+1)] | |
for i in range(m): | |
for j in range(n): | |
if i==0 or j==0: | |
S[i][j] = 1 | |
else: | |
S[i][j] = S[i-1][j] + S[i][j-1] | |
n_paths = S[m-1][n-1] | |
print(f"Number of unique paths: {n_paths}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment