Engrain by ByteRush

DSA.12.03 Senior

Pattern 18b: Dynamic programming — 2D and knapsack

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

  • grid DP
  • two-string DP (LCS, edit distance)
  • 0/1 knapsack and subset sum
  • reconstructing the answer

Words you will know

knapsackedit distance

What you will practise

  • unique-paths (M)
  • longest-common-subsequence (M)
  • partition-equal-subset-sum (M)
  • edit-distance (H)