LeetCode 63 Minimum Path Sum

2015-07-20 17:46:17 · 作者: · 浏览: 5

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.

思路 :求grid[0][0]到grid[i][j]的最小和,就必须得出以下公式

\

public class Solution {
    public int minPathSum(int[][] grid) {
    	int i,j,min;
    	
    	for(i=1;i