Thoughts on DSA and math as we have been taught since years...
Source: Dev.to
Introduction
I’ve been thinking about something lately — and I don’t fully have it figured out yet, so this is more like me thinking out loud than giving advice.
Every time an interview is coming up, I go back to Striver’s sheet and start from the beginning again. I solve problems I’ve already solved. While solving I’m like “haan this I know”… but give it a couple of weeks and it’s gone. Not just the code — sometimes even the approach. And then I’m back to square one.
I think the issue (at least for me) is how I’m learning DSA. It’s very pattern‑based:
- this is sliding window
- this is prefix sum
- this is two pointers
The whole game becomes:
“Can I recognize this pattern from the question?”
But the moment the question is even slightly twisted, my brain just goes: “nope 👍”.
When we were kids, we didn’t learn math like this. It wasn’t abstract; it was apples, money, counting things around us. You could see it. Now it’s all symbols, tricks, patterns, and somewhere along the way we stopped seeing it in real life, even though it’s probably still there.
A Different Perspective
Instead of doing
“question → pattern”
what if we try
“pattern → where does this exist in real life?”
In other words, rather than recognizing patterns in problems, we connect them to real‑world situations.
Example 1: Subarray Sum = K
Typical mental shortcut: “prefix sum + hashmap 👍 done”. Two weeks later: “what hashmap?? 😭”.
Real‑world analogy: You’re monitoring CPU usage over time, logging usage every second. Sometimes it spikes to 90 %, and the system triggers a reset. While debugging you want to find which continuous time window caused this spike.
You are essentially:
- Accumulating usage
- Scanning through time
- Finding a continuous chunk where the total = 90
The moment you find it → that’s your culprit → that’s your reset trigger.
That’s literally the subarray‑sum‑equals‑k problem, but it feels less like “apply a pattern” and more like “this is what I’d naturally do”.
Example 2: Minimum Window Substring
Typical mental shortcut: “sliding window, freq map, shrink when valid”. Result: forgotten in 10 days 💀.
Real‑world analogy: You’re cooking. You have a long list of ingredients available (that’s s). Your goal: find the smallest portion of your available ingredients that still contains everything needed.
So you:
- Keep picking ingredients
- Check: “do I have everything?”
- If yes → try removing extra stuff
- Keep shrinking till it’s just enough
That’s literally “expand → satisfy → shrink → optimize”, but it feels like common sense instead of a “technique”.
What I’m Trying to Get At
Maybe the issue isn’t lack of practice or bad memory. Maybe it’s this:
“I’m trying to remember patterns I never actually experienced.”
The Shift I Want to Try
Instead of asking:
“Which pattern is this?”
maybe ask:
“Where would this happen in real life?”
I don’t know if this works yet, but it feels like it might stick better than grinding the same sheet, restarting before every interview, or pretending I “know” something I clearly don’t remember later.
I’m going to try this with a few more problems. Worst case: nothing changes.
If you have tried something like this that works for you, let me know in the comments!