leetcode 64. 最小路径和

标准路径规划

class Solution {
    public int minPathSum(int[][] grid) {
        //dp[i][j]为到达当前位置(含当前)的最小值
        if(grid==null){
            return 0;
        }
        int m=grid.length;
        int n=grid[0].length;
        int[][] res=new int[m][n];
        res[0][0]=grid[0][0];
        for(int i=1;i

你可能感兴趣的:(leetcode)