Unique Paths
Source
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).
How many possible unique paths are there?
Note
m and n will be at most 100.
Python
class Solution:
"""
@param n and m: positive integer(1 <= n , m <= 100)
@return an integer
"""
def uniquePaths(self, m, n):
row=[0]*m
row[0]=1
for i in range(n):
for j in range(1, m):
row[j]+=row[j-1]
return row[m-1]