64. Minimum Path Sum
Practice Minimum Path Sum for free on NudgeCode: Medium, Dynamic Programming pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
Each cell of grid holds a non-negative number. Walk from the top-left cell to the bottom-right cell, moving only right or down. Return the smallest possible sum of the numbers on the cells you visit, including both ends.
Example
grid = [[1,3,1],
[1,5,1],
[4,2,1]] -> 7 (1 -> 3 -> 1 -> 1 -> 1)
grid = [[1,2,3],[4,5,6]] -> 12
Constraints
- 1 <= rows, cols <= 200
- 0 <= grid[i][j] <= 200