DSA Practice.
How I practise data structures and algorithms, by patterns not random problems.
Last updated
On this page
How I got good at DSA wasn't luck. None of this is revolutionary. It's just consistent, unglamorous reps over a long time, and it compounds.
LeetCode, through NeetCode
I practise LeetCode problems, but I do them through NeetCode, because every problem has a video solution attached.
My rule for each problem:
- Set a 30-minute timer.
- If I can't get an intuition in that time, I watch the video solution.
- Understand why it works and how it works.
- Code it out myself, without copying.
- Add it to my DSA practice repo and type out my thought process, so it sticks.
Patterns, not random problems
I stopped grinding random problems and started grinding patterns:
- Sliding window
- Two pointers
- DFS / BFS
- DP on grids
Once you see the pattern behind a problem, you stop memorising and start recognising.
Track what I get wrong
I track what I get wrong, not just what I solve. Hundreds of solved problems mean nothing if you're not reviewing your failure patterns. That's where the real improvement is.
I also keep my solutions together with an explanation of how I thought through each one.
Explain it out loud
I explain every problem out loud, even when no one's listening. If I can't explain my approach in plain English before I code it, I don't actually understand it yet. More on this in Communication.
Watch mock interviews
Watching how other people think, where they get stuck, and how they recover taught me more about interview flow than any problem set. More in Mock Interviews.
Turn it into content
Turning DSA practice into content on PKodes forced me to break things down clearly enough to actually make sense to someone else.