The idea is the same as the standard DP solution. Construct the DP table one row at a time, from left to right.

```
class Solution(object):
def uniquePaths(self, m, n):
res = [1] * n
for i in range(m-1):
for j in range(1, n):
res[j] += res[j-1]
return res[-1]
```