classSolution:defuniquePaths(self,m:int,n:int) ->int: dp = [[1] * n for _ inrange(m)]for i inrange(1, m):for j inrange(1, n): dp[i][j] = dp[i -1][j] + dp[i][j -1]return dp[-1][-1]
classSolution:defuniquePaths(self,m:int,n:int) ->int:if m > n: m, n = n, m dp = [1] * mfor _ inrange(1, n):for i inrange(1, m): dp[i]= dp[i]+ dp[i -1]return dp[-1]