Optimal Algorithmic Approach
Interval DP: fill table by subproblem length.
Core Invariants & Edge Cases
- dp[i][j] = min cost to multiply matrices i through j
- Try all splits k: dp[i][j] = min(dp[i][k] + dp[k+1][j] + p[i-1]*p[k]*p[j])
- Fill by increasing chain length