Define = minimum cost to multiply matrices from i to j (inclusive). Base case: = . A single matrix requires no multiplication. Goal: find , the minimum cost to multiply all matrices. Each dp[i][j] must capture everything needed to solve that range independently.
If you are missing information, you cannot compute the answer correctly. If you include too much, your solution will be slow or use too much memory.