Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.
Note: You can only move either down or right at any point in time.
思考:DP方程:dp[i][j]=grid[i][j]+min(dp[i-1][j],dp[i][j-1])。
class Solution {public: int minPathSum(vector> &grid) { // IMPORTANT: Please reset any member data you declared, as // the same Solution instance will be reused for each test case. int m=grid.size(); int n=grid[0].size(); int i,j,ret=0; int **dp=new int*[m]; for(i=0;i