revision day · dynamic programming · blank-file recall
Tonight's goal: pick the three weakest DP problems from this menu, then prove you can rebuild the state, transition, base case, and answer location without hints.
can a subset make sum s; use or skip each item; empty subset makes zero; answer at dp[target]
Warm-up MCQs
1. Which checklist belongs before any DP solve?
“Every DP is four answers: what dp[i] means, how it comes from smaller states, the base case, and where the final answer lives. Here: ways(i) = ways(i-1) + ways(i-2).”
2. Which comparison matches House Robber?
“At each house choose: rob it and add dp[i-2], or skip it and keep dp[i-1] — dp[i] = max(dp[i-1], nums[i] + dp[i-2]).”
3. What must happen to unreachable Coin Change amounts?
“dp[amount] = 1 + the minimum of dp[amount - coin] over every coin; amounts you can never make stay infinite.”
4. Which state is precise enough for LIS?
“Define dp[i] as the best subsequence ending exactly at i: one more than the best dp[j] over all j < i with nums[j] < nums[i].”
5. Which sweep protects the one-use subset rule?
“Ask ‘can some subset hit this exact target?’ where target = totalSum/2; each item is usable once, so sweep targets from high to low.”
Self-check gate
Pass tonight only if this is true
All three selected problems pass on run one or run two, and before each solve you can say the state, transition, base case, and answer location without reading the lesson.
If any problem needs a hint, fails after two runs, or has a blurry four-sentence drill, it does not count as revised. Write WA: <root cause>, add that problem to the next revision day, and compare with the source lesson after the attempt.