Interval DP
Fill a triangular table by range length; each range takes the cheapest split into two shorter ranges.
Decision · step 2 of 8Interval DP: Merging adjacent piles
dp[0][1], length 2: split at 0: 0 + 0 + 5 = 5. Best is 5, splitting at 0: merge piles 0..0 and 1..1 last, paying their total 5.
What you will see
The table fills diagonal by diagonal.
Cost
| Best | O(n^3) |
|---|---|
| Average | O(n^3) |
| Worst | O(n^3) |
| Space | O(n^2) |
How you work with it here
play it through, step one change at a time, scrub to any step, run it on your own input, predict what happens next.
Screen readers: Table cells announce their state and value; each step announces which cells were read and the value written.
Reduced motion: Dependency arrows appear statically and the cell value crossfades.