My simple Python solution - 5 lines


  • 0
    D
    def uniquePaths(self, m, n):
            path=[[1]*n]*m
            for i in range(1,m):
                for j in range(1,n):
                    path[i][j]=path[i-1][j]+path[i][j-1]
            return(path[-1][-1])
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.