class Solution {

public:

```
int minPathSum(vector<vector<int>>& grid) {
int row = grid.size(),column = grid[0].size();
vector<int> dp(column,INT_MAX);
dp[0] = 0;
for (int i = 0;i < row;++i)
for (int j = 0;j < column;++j)
dp[j] = j==0?dp[j]+grid[i][j]:grid[i][j] + min(dp[j],dp[j-1]);
return dp[column-1];
}
```

};