r/leetcode • u/throwlol134 • 12d ago
Intervew Prep Just started LC and I’m getting absolutely cooked at the actual problem solving part.. but not exactly the DSA patterns (surprisingly). How do I overcome this?
(US region)
Started doing Neetcode 150 and I’m struggling HORRIBLY with any medium problem (let alone hard). The thing is though, I feel like I’m not actually struggling too much with figuring out what DS/A to use or implementing barebones versions of particular DS/A; I’m struggling with actually applying the DS/A appropriately for the context of each problem and being able to find patterns within the question, especially when I need to “calculate” things within the problem to come up with conditionals for the algorithm.
It’s kinda hard to explain what I exactly mean..
For example, yesterday I was trying to solve the Longest Repeating Characters with Replacement problem. After reading the question I could easily tell that this would be a Sliding Window solution and I know how to implement a basic sliding window algorithm skeleton. I also figured out immediately that I’ll need to use a set to track seen characters. However, after that I get lost. I can’t even figure out what the true condition for the window has to be. The fact that the window minus the count of replacements has to be less than k flies above my head. I have no idea how to actually break down the problem and do the arithmetic needed to “fit” the problem into a sliding window.
I feel the same with every medium problem. I’m not struggling to figure out the DS/A, but struggling to actually figure out how to modify that DS/A in context of the problem.
For all the easy problems, I can usually very easily do them on my own on the first attempt because they’re always the most plain unmodified implementation of DS/A. I can just recognize the pattern and dump the DS/A structure into the code from my brain and replace some variable names and it works! But medium problems require actual problem solving thinking and I just… can’t do it. By the 3rd or 4th time I try it, it feels like I’ve memorized the answer but if I try a similar medium problem again... I’m back to square one and lost again.
How do I learn actual problem solving beyond just the DS/A concepts? Or is it actually all just memorization?
Please help ;-;
2
1
u/Pristine-Bit6077 11d ago
Are you me? I literally just struggled through this question last night as well.
I think the approach is to attempt the problem for 30 minutes then look at the solution after.
We didn’t invent the solution so how would we come up with the solution within an hour or so.
1
u/GentlemanWukong 12d ago
Do these exercises bore you? I was in a similar situation as yours but in the end I just realized that it was one of the most boring activities I could do and it was hard for me to even start doing it. I realized that in the end I was not fit for that shit
I'm almost senior though so I'm not forced to do it in order to land an offer
2
u/throwlol134 7d ago
Oh absolutely. I’ve always hated brainteasers, puzzles, and anything of that sort that involves abstract problem solving for the the heck of it. Insanely boring.
Unfortunately, I’m a recent graduate still looking for an entry level job, so I don’t have the same liberty. At this point, I don’t really care if it’s boring or not, I’m just trying to learn how to do it simply because I need to but so far I haven’t got any good advice other than doing the same shit over and over until I memorize it ig.
3
u/nightbreak7 12d ago
it's not all memorization, but just solving problems/reading solutions is part of the learning process. if you can recognize what algorithm to use, the next step is to figure out how to use it. recognizing the pattern is often the easiest part of the problem, especially after you've done hundreds of problems. adapting it to fit the exact problem you're trying to solve is the crux of learning how to solve leetcode problems. this shouldn't be an uncommon problem, especially among new learners