A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).
The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked ‘Finish’ in the diagram below).
classSolution(object):defuniquePaths(self,m,n):""" :type m: int :type n: int :rtype: int """ifm<=0orn<=0:return0dp=[[0]*(n+1)foriinrange(m+1)]# make the first row as 1foriinrange(n+1):dp[1][i]=1# dp starts from the second rowforiinrange(2,m+1):forjinrange(1,n+1):dp[i][j]=max(dp[i-1][j],dp[i][j-1]returndp[m][n]