Start DP from state definition, not from formulas
The safest starting point for DP is a plain sentence:
The safest starting point for DP is a plain sentence:
What exactly does dp[i] or dp[i][j] mean?
Once state meaning is clear, transition logic has somewhere stable to stand.