← Dynamic Programming

Pattern Recognition Drill

#68 — Minimum path sum in grid

Medium Dynamic Programming

The Problem

Find path from top-left to bottom-right minimizing sum. Move only right or down.

What approach would you use?

Think about it before scrolling down.

Key Signals

Dynamic Programming

Fill grid: each cell = own value + min(above, left). O(m*n) time. Can reuse the grid for O(1) extra space.

Common Trap

BFS/DFS would explore too many paths. The constraint (only right/down) makes DP perfect — no cycles.

← #67 #69 →