dp[i][j] = min over k of ( dp[i][k] + dp[k+1][j] + p[i-1]·p[k]·p[j] ). Watch the table fill by increasing chain length, the split point k that wins, and the reconstructed parenthesization.
Aᵢ has shape p[i-1] × p[j]; multiplying p×q by q×r costs p·q·r.
The diagonal dp[i][i] = 0. The split table records the winning k for reconstruction. See junior.md and professional.md for the optimal-substructure proof.