Grokking Dynamic Programming Patterns for Coding Interviews
Dynamic programming broken into a handful of recognisable families such as knapsack, unbounded knapsack, longest common subsequence and palindromic subsequence, rather than presented as a bag of clever tricks. It is the topic most candidates give up on, which is exactly why learning it pays.
Course
Interview Prep
Design Gurus
3 to 5 weeks
Advanced
Subscription
Why this topic specifically
Dynamic programming is where most preparation stalls. The standard explanation, which is that you find the recurrence and memoise it, is true and useless, because finding the recurrence is the entire difficulty. Candidates read ten solutions, understand each one, and still cannot start the eleventh problem.
The approach
This course groups DP problems into families. Once you have seen zero-one knapsack properly, the subset sum, equal subset partition, minimum subset difference and count-of-subsets problems are all the same machinery with a different question at the end. The same holds for the subsequence family and the interval family. Five or six families cover most of what gets asked.
How to use it
Do the brute force recursion by hand first, every time, before looking at the memoised version. The habit of writing the naive recursion and then mechanically adding a cache is what makes DP feel routine, and it is a habit you build only by doing it slowly at first.
Best for: candidates who have the other patterns down and keep losing interviews to one DP question.
Ready to start?
Opens on Design Gurus in a new tab.
Stuck on something specific?
Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Every session is free; a few slots open each week.
Follow along
New writing, resources and project ideas land here first.