dynamic-programmingtips
Name the state before the recurrence
Anonymous
before writing a DP recurrence, say exactly what dp[i] means in one sentence. Each transition should explain how a smaller state builds the current one, and the base case should match that meaning. If a transition needs information the state doesn't preserve, the state definition is missing something.
0