https://leetcode.com/problems/minimum-path-sum/
dp 很简单
const int SIZE = 1001;
class Solution {
public:
int minPathSum(vector< vector<int> >& grid) {
int m = grid.size(), n=grid[0].size(); //
for(int i=0;i<m;i++) {
for(int j=0;j<n;j++) {
if(i == 0 && j == 0) dp[i][j] = grid[i][j];
else {
dp[i][j] = grid[i][j] + min(
(i-1>=0?dp[i-1][j]:1000000) ,
(j-1>=0?dp[i][j-1]:1000000)
);
}
}
}
return dp[m-1][n-1];
}
private:
int dp[SIZE][SIZE];
};