64 Minimum Path Sum
64. Minimum Path Sum
1. Question
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.
Example 1:
Given the above grid map, return7
. Because the path 1→3→1→1→1 minimizes the sum.
2. Implementation
(1) DP
3. Time & Space Complexity
时间复杂度O(mn), 空间复杂度O(mn)
Last updated