You are 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 1:
Input: grid = [
[1,2,0],
[5,4,2],
[1,1,3]
]
Output: 8Explanation: The path with minimum sum is 1 -> 2 -> 0 -> 2 -> 3.
Example 2:
Input: grid = [
[2,2],
[1,0]
]
Output: 3Constraints:
m == grid.lengthn == grid[i].length1 <= m, n <= 2000 <= grid[i][j] <= 200