I've done something like sixty DP problems and it still doesn't click the way graphs eventually did
Graphs took maybe fifteen problems before I started recognizing the shape of a BFS-shaped question versus a Union-Find one. DP just hasn't done that for me. I can follow a solution once it's explained, I can even implement it if someone tells me it's DP, but staring at a fresh problem I never see "oh, overlapping subproblems" on my own. I've tried the pattern lists, the "identify the state" frameworks, redoing problems a week later. Is this just more reps than I think, or is there something about how I'm studying it that's off?
2 comments
- 0
AnonymousAnon The framework that finally worked for me was drawing the recursion tree by hand for the first ten problems, even the easy ones, until I could see the repeated subtrees myself instead of being told they existed. Slower up front but it stuck.
- 0
AnonymousAnon For me it clicked when I stopped starting from the recurrence and started from 'what decision am I making at each step and what do I need to remember to make it.' Writing that sentence out before any code, every single time, eventually turned into pattern recognition.