Rows and columns must each represent a real part of the subproblem.
Two-Dimensional DP
5 chapters · 12 challenges · The Echo Matrix
Understand the idea, practise through play, then prove it in code. Choose your next quest below.
Visual introduction to this topic
What is two-dimensional dynamic programming?
Two-dimensional DP stores answers identified by two changing coordinates, such as row and column, two string positions, or the ends of an interval.
Think of mapping a tiled dungeon. The best answer for one tile depends on already mapped neighbors. Record each tile once, then let later tiles build on it.
The dependency arrows decide the only safe order for filling the table.
A state may read left, up, diagonal, smaller intervals, or another layer.
Empty prefixes and outer rows often remove special cases from the transition.
Combine answers from above and left
Grid Paths
0/3 completePractice grid paths through 3 visual expeditions.
String Alignment
0/3 completePractice string alignment through 3 visual expeditions.
Interval DP
0/2 completePractice interval DP through 2 visual expeditions.
Knapsack
0/2 completePractice knapsack through 2 visual expeditions.
Memoized Search
0/2 completePractice memoized search through 2 visual expeditions.
Built from authoritative material
This track is checked against the sources below. Visual traces still carry their own complete or guided coverage label, so unfinished explanations are not presented as complete executions.