Medium

Quiz

#64 Minimum Path Sum

APPROACH

In m x n grid of non-negative integers, find a path from top-left to bottom-right — moving only right or down — that minimizes the total sum of values along the path.

Example 1:

Input: grid = [[1,3,1],[1,5,1],[4,2,1]]
Output: 7
Explanation: Because the path 1 → 3 → 1 → 1 → 1 minimizes the sum.

Example 2:

Input: grid = [[1,2,3],[4,5,6]]
Output: 12
1 of 4
1:00

What is the optimal approach for this problem?