Skip to main content

Grid Paths

Learn Grid Paths (Dynamic Programming, Advanced DSA) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

The General 2D DP Grid Pattern Many grid problems (unique paths, min path sum, max path sum, obstacle paths) share ONE shape: dp[r][c] depends only on dp[r-1][c] (from above) and dp[r][c-1] (from the left) - since movement is restricted to right/down. Fill the grid row by row, left to right, and each cell's answer is ready by the time you need it.

More lessons in Dynamic Programming