Minimum Path Sum with Obstacles
Carry the best cost across cells.
From Counting to Costing
Now each cell holds a value and you want the cheapest route to the corner. The goal shifts from counting paths to minimizing a cost.
Define the State
Let dp[i][j] be the smallest total cost to reach cell (i, j). Same grid, same moves, but we track sums instead of counts.
All lessons in this course
- Path Counting on a Grid
- Minimum Path Sum with Obstacles
- Longest Common Subsequence
- Edit Distance Step by Step