Grid, lattice, substring, and state-machine dynamic programming

Multidimensional DP

These visualizers spread DP across grids, windows, and layered state machines so you can watch information flow spatially instead of only along a line.

Best Time to Buy and Sell Stock III

Hard

Watch profit flow through a four-stage trading control room where each day can upgrade the first buy, first sell, second buy, or second sell state.

DP state machine / at most two transactions / profit optimization

Open visualizer

Best Time to Buy and Sell Stock IV

Hard

Scale the trading ladder to k transactions and watch each price update a full stack of buy and sell layers.

DP state machine / k transactions / layered optimization

Open visualizer

Edit Distance

Medium

Step through an edit laboratory where insert, delete, and replace compete cell by cell inside the transformation matrix.

2D DP / string transformation / operation cost matrix

Open visualizer

Interleaving String

Medium

Use a weave loom to track whether prefixes of two source strings can interlace cleanly into the target ribbon.

2D DP / string weave / prefix compatibility

Open visualizer

Longest Palindromic Substring

Medium

Scan a resonance table of substring windows and watch mirrored endpoints light up the longest valid palindrome in the string.

2D DP / substring windows / palindrome table

Open visualizer

Maximal Square

Medium

Use a square radar to grow all-ones squares from every valid cell and watch the largest area emerge from the DP field.

2D DP / square growth / binary matrix

Open visualizer

Minimum Path Sum

Medium

Traverse a luminous atlas where every cell chooses the cheaper path from above or left until the destination cost stabilizes.

2D DP / grid path cost / right and down transitions

Open visualizer

Triangle

Medium

Descend through a crystal lattice where each cell inherits the cheaper of its two parents above and the minimum path reveals itself in the bottom row.

2D DP / triangular grid / minimum path sum

Open visualizer

Unique Paths II

Medium

Watch path counts flow around obstacles as the robot's reachable field expands through the grid one open cell at a time.

2D DP / obstacle grid / path counting

Open visualizer