awesome-everything RU
↑ Back to the climb

Algorithms from zero

Dynamic programming: free-recall review

Crux Free-recall prompts across the DP unit. Answer each in your own words first, then reveal the model answer and compare.
Your altitude — climbing toward senior
ZeroJuniorMiddleSenior
You are at middle altitude — in the sky
◷ 14 min

Retrieval beats re-reading. For each prompt, say or write a full answer from memory before you open the model answer — the effort of recall is what makes the material stick.

Goal

Reconstruct the unit’s spine — the two enabling properties, memoization vs tabulation, how to design a state and its transition, and how space optimization works — without looking back at the lessons.

Recall before you leave
  1. 01
    What two properties must a problem have before dynamic programming applies, and what does each one buy you?
  2. 02
    Contrast memoization and tabulation. When would you pick each?
  3. 03
    How do you design the state for a DP problem, and what makes a state correct?
  4. 04
    What is a transition, and why must the iteration order respect it?
  5. 05
    Explain how space optimization (the rolling array) works and when it is safe.
  6. 06
    Take Longest Increasing Subsequence: give the O(n^2) DP, the O(n log n) idea, and the trap in the fast version.
Recap

If you could reconstruct each answer from memory, you hold the unit’s spine: confirm overlapping subproblems and optimal substructure, choose memoization or tabulation by stack depth and space needs (not big-O), design the minimal sufficient state, write a transition over every choice and iterate in an order that respects it, and roll the table down to a window only when no still-needed value is overwritten. Same complexity either way — states times work per state.

Continue the climb ↑Dynamic programming: code reading
shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources3
expand
  1. 01
  2. 02
  3. 03

Trademarks belong to their respective owners. Editorial reference only.