Minimum Path Sum
Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.
Note:You can only move either down or right at any point in time.
分析
动态分布,从左或者上来的.
因为是最小,所以第一行/列的初始化要是max才能保证不干扰答案。还有f[1][1] = grid[0][0]。 画图就知道
Last updated
Was this helpful?