Very neat, very beautiful!

```
class Solution {
public:
int minPathSum(vector<vector<int>>& grid) {
int m = grid.size(), n = (m>0)?grid[0].size():0;
if(m==0 || n==0) return 0;
for(int i=0;i<m;i++) {
for(int j=0;j<n;j++) {
if(i==0&&j==0) continue;
grid[i][j] += min((i==0)?INT_MAX:grid[i-1][j], (j==0)?INT_MAX:grid[i][j-1]);
}
}
return grid[m-1][n-1];
}
};
```