Select a subset of items maximizing value without exceeding capacity. Canonical 2D DP with classic 1D space compression.
n items
or O(W)
Visual table fill, decisions (take/skip), and reconstruction of optimal set.
Recurrence, space compression trick, reconstruction logic, use cases.