[leetcode]-64. Minimum Path Sum(C语言)

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.

Example:

Input:
[
  [1,3,1],
  [1,5,1],
  [4,2,1]
]
Output: 7
Explanation: Because the path 1→3→1→1→1 minimizes the sum.
int minPathSum(int** grid, int gridRowSize, int gridColSize) {
    int i,j,k;
    int path[gridRowSize][gridColSize];
    path[0][0]=grid[0][0];
    if(gridRowSize==1)
    {
        int sum=0;
        for(j=0;j

 

你可能感兴趣的:([leetcode]-64. Minimum Path Sum(C语言))