Two-dimensional states often describe a physical position or two consumed prefixes. A grid cell depends on neighbors. A pair of string-prefix lengths describes which edits or interleavings are still possible. Name both coordinates before choosing a table layout. A rolling row saves space only when every dependency still refers to the correct old or new row.
Boundary states do much of the work. Blocked cells erase route counts, empty text prefixes have meaningful edit costs, and repeated letters may leave more than one valid interleaving. A greedy match can discard the path you need later.
The last problem changes the state shape to an interval. Choosing the final removal inside an interval fixes its neighbors and separates the remaining work into independent left and right pieces. It is the same habit: choose a state that makes the next decision well defined, then process smaller dependencies first.
costs = [[2,8,1],[3,1,4]]
first row minimum costs: [2,10,11]
second row: [5,6,10]
At cost 1 in the second row, choose min(10 from above, 5 from left).
The cheapest complete route costs 10, including both endpoints.
Build states over grids, string prefixes, and open intervals.