Struggling with Data structures & Algorithms
Posted by ManFromEarth_666@reddit | learnprogramming | View on Reddit | 6 comments
Hello everyone, I'm a self-taught developer and have been working professionally for years now, but to be honest, I was always bad at DSA and LeetCode and I mostly ignored it.
This hasn't caused any issues in my real job. I've even had senior and lead roles in small teams. I'm not that bad at what I do, as far as I know.
But LeetCode and algorithms are different beasts. It is sometimes very hard for me to wrap my head around a new concept. Even if I get the hang of it today, it's like I forget what I learned three days later and end up coding a broken version of it when I try again.
The latest thing I'm getting stuck on is sorting algorithms, merge sort and insertion sort. I understand the idea, but if someone asked me to code one from scratch three days later, I'd 90% be staring at the screen for a while and then come up with a broken version.
Soon I'm moving to a country where interviewers mostly use LeetCode-style questions, so I'm kind of freaking out.
Does anyone have any tips, or is this just a lost cause? Do some of us not have the mental capacity for abstract concepts?
Any tips would be really welcome.
Dry-Hamster-5358@reddit
This is more normal than you think.
DSA isn’t about remembering code line by line, it’s about patterns. If you forget after a few days, it just means you haven’t repeated it enough yet.
What helps: - revisit the same problem after 2–3 days - write it again from scratch (no copy) - focus on why it works, not just the steps
Sorting is a good example — once you really get the idea behind merge sort vs insertion sort, coding it becomes easier over time. Also, don’t stress about “mental capacity.” It’s mostly practice + exposure.
You’ve already been working professionally, so you’re not lacking ability — just training a different skill.
Accomplished_Pen4228@reddit
Life’s pretty funny… how does a guy with no dsa skills, leetcode, or a concrete understanding of an insertionSort implementation get senior roles, while I, being a year removed from college, have had none😭😭
teerre@reddit
Understanding algorithms and doing well in leetcode are almost independent. The latter can be done by simple memorization, there's only so many classes of problems. By far the best way to learn leetcode is to do it a lot without trying to understand. Just think about it, if you can't quickly say what's the solution, look it up. Repeat. Eventually you'll see patterns
Understand algorithms takes more work. Like pretty much all mathematics, it's much harder if your basis aren't solid. For that I recommend Stepanov's From Mathematics to Generic Programming. It goes from the beginnings of occidental math, literal how to count integers, to advanced topics like genetic algorithms. It's a heavy read, but it will teach the actual foundations of algorithms thinking
Striking_Display8886@reddit
Take breaks in between learning!
my_peen_is_clean@reddit
repeat the same 10–15 patterns like a workout, not like school. sorting, two pointers, bfs/dfs, backtracking. hand write them till you can do them half asleep. it really is just reps, esp in this mess of a market
ManFromEarth_666@reddit (OP)
Thank you, that is a good tip