Skip to main content

DSA pattern

Dynamic Programming

Dynamic programming solves complex problems by breaking them into simpler subproblems, storing results to avoid recomputation. Use memoization (top-down) or tabulation (bottom-up) based on the problem structure.

When to use

5 signals
  1. 01Optimization problems (min/max)
  2. 02Counting problems (number of ways)
  3. 03Decision problems (is it possible)
  4. 04Problems with overlapping subproblems
  5. 05Sequence problems (LCS, LIS)

In interviews, call out the pattern early. It helps interviewers follow your reasoning and keeps your implementation focused. After solving, explain tradeoffs in plain language: why this approach is efficient, where it can break, and what edge cases you would test first.

Practice problems

5 listed
  1. 01Climbing StairsPractice →
  2. 02Coin ChangePractice →
  3. 03Longest Common SubsequencePractice →
  4. 04House RobberPractice →
  5. 050/1 KnapsackPractice →

Build a review loop

Treat each pattern as a repeating cycle, not a one-time read. Solve a fresh problem today, revisit the same pattern in 2-3 days, and run one timed attempt at the end of the week. This turns short-term familiarity into reliable recall for live interviews.

When reviewing, re-derive the core steps from scratch before checking a reference solution. If you can explain the state transitions and edge cases clearly, you are much more likely to execute well under interview pressure.