Dynamic Programming21 sections · 916 units
Open in Course

LeetCode 64 Minimum Path Sum - Problem Statement

Find cheapest path

You have an mm×nn grid filled with non-negative numbers. Find a path from top-left to bottom-right that minimizes the sum of numbers along the path. You can only move right or down at each step. Unlike Grid Paths where you count paths, here you want the cheapest one.

This is a classic grid DP problem. Before reading on, think: what should dp[ii][jj] represent?