Skip to content

Instantly share code, notes, and snippets.

@mvallebr
Created March 3, 2021 11:05
Show Gist options
  • Select an option

  • Save mvallebr/6fe1bd25823bc66d6ff9bcbe25cc7366 to your computer and use it in GitHub Desktop.

Select an option

Save mvallebr/6fe1bd25823bc66d6ff9bcbe25cc7366 to your computer and use it in GitHub Desktop.
class Solution:
def uniquePaths(self, m: int, n: int) -> int:
grid = [[1] * n for _ in range(m)]
for i in range(1, m):
for j in range(1, n):
grid[i][j] = grid[i - 1][j] + grid[i][j - 1]
return grid[-1][-1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment