The fastest time: `52 ms,beats 100.00%`

.

```
def minPathSum(self, grid):
m, n = len(grid), len(grid[0])
dp = [0] * n
for i in xrange(m):
dp[0] += grid[i][0]
for j in xrange(1, n):
dp[j] = (min(dp[j], dp[j-1]) or dp[j-1]) + grid[i][j]
return dp[-1]
```