Engrain by ByteRush

DSA.12.02 Mid-levelCore — asked often

Pattern 18a: Dynamic programming — 1D

Comes up in: DSA

This concept is being written. It gets the full five steps — explanation, predict, interview angle, practice with tests, and review cards. Here is exactly what it will cover, so you can study it elsewhere in the meantime.

What it covers

  • overlapping sub-problems + optimal substructure
  • top-down memo vs bottom-up table
  • state, transition, base case
  • space optimisation

Words you will know

dynamic programmingmemoisationtabulationstatetransition

What you will practise

  • climbing-stairs (E)
  • house-robber (M)
  • coin-change (M)
  • word-break (M)
  • decode-ways (M)
  • longest-palindromic-substring (M)
  • longest-increasing-subsequence (M)

Interview questions this answers

  • Top-down vs bottom-up DP: trade-offs?
  • Solve coin change. Explain the state and transition.