dp[i][j] = min over k<j of ( dp[i-1][k] + C(k,j) ). Watch compute(l, r, optL, optR) resolve the middle column, then recurse with narrowed split windows.
C(k, j) = (prefixSum[j] - prefixSum[k])² (Monge), so opt(i, j) is non-decreasing in j. Row 0 is the base case (dp[0][0]=0, else ∞).
Each compute call resolves its mid column by scanning [optL, min(optR, mid-1)], then recurses left with [optL, opt(mid)] and right with [opt(mid), optR]. See middle.md and professional.md for the O(n log n) proof.