DEV Community

Kriti
Kriti

Posted on

Thoughts on DSA and math as we have been taught since years...

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 there’s an interview coming up, I go back to Striver’s sheet and start from the beginning. Again. Solve problems I’ve already solved. While solving I’m like “haan this I know”… but give it a couple 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.

Like:

  • this is sliding window
  • this is prefix sum
  • this is two pointers

And the whole game becomes:

«“Can I recognize this pattern from the question?”»

But the moment the question is even slightly twisted… brain just goes:

«nope 👍»


But when we were kids, we didn’t learn like this.

Math 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.


So I had this thought (again, not a solution, just a thought):

Instead of doing

«question → pattern»

What if we try

«pattern → where does this exist in real life?»

Like instead of recognizing patterns in problems…
recognize problems in patterns.


Example 1: Subarray Sum = K

Normally my brain goes:

«prefix sum + hashmap 👍 done»

Also my brain 2 weeks later:

«what hashmap?? 😭»


Now think of it like this:

You’re monitoring CPU usage over time. Every second you log usage.

Sometimes it spikes to 90%, and whenever that happens, the system triggers a reset.

Now you’re debugging.

You want to find:

«which continuous time window caused this spike?»

So you’re basically:

  • accumulating usage
  • scanning through time
  • trying to find a continuous chunk where total = 90

The moment you find it → that’s your culprit → that’s your reset trigger.

That’s literally:

«subarray sum = k»

But here it feels less like:

«“apply pattern”»

and more like:

«“yeah this is what I’d naturally do”»


Example 2: Minimum Window Substring

Again, usual approach:

«sliding window, freq map, shrink when valid»

Also usual result:

«forgotten in 10 days 💀»


Now imagine:

You’re cooking.

You have a long list of ingredients available (that’s "s")
You have a recipe that needs specific ingredients (that’s "t")

Your goal:

«find the smallest portion of your available ingredients that still contains everything needed»

So what do you do?

  • 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 some “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
  • 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
Best case: I finally stop restarting Striver from day 1 every time 😭

If you have tried something like this which works for you, do let me know in the comments!

Top comments (0)