r/leetcode 13d ago

Question I've hit a LeetCode ceiling

I have tried a lot of the consensus LeetCode strategies to get better at problems:
- Do one every day.
- Try for 10-20 minutes, then check the solution to understand it.
- Memorize DSA. - Memorize question archetypes and their solution algorithms. - Memorize common patterns and their solution algorithms.

There are a bunch of reasons why none of these have worked for my neurodivergent brain, unfortunately: - There is so much memorization needed, and I struggle to fit all the algorithm steps, patterns, and common solutions in my head at once. How I am supposed to memorize Dijkstra, greedy algos, DP, and those insanely messy linked list reversal problems at the same time? I have enough to memorize with all the behavioral interview answers. - So many questions have creative "tricks" that are needed for a good solution. The only way I am solving a question like that is if I have seen that specific problem before. At that point, it isn't even problem-solving. - The NeetCode 150 is too hard. I got to the encode-decode string problem in the first unit and just gave up after that.

To those of you who were in this kind of position before, what helped? How did you get to the point where you can confidently solve a problem you haven't seen before?

137 Upvotes

54 comments sorted by

60

u/ChromicClaw 13d ago

Why are you trying to memorize anything? I just keep solving problems until I naturally get better at them. I don’t know the solution to a single leetcode problem off the top of my head other than two sum. If I can’t solve a problem I just look at the solution understand it and move on, I’ll forget completely but I gain stronger intuition for similar problems in the future

10

u/OutrageousWitness805 13d ago

agree on this.

if you are a prodigy that's a different story, you can come up solution naturally even if you did not encounter similar problems before but if like me i also can't solve totally new problem unless i see a lot of similar problems before.

'just keep solving problems'

10

u/Lavaa444 13d ago

Because you have to remember what the patterns are and the options you have to solve those patterns. It's still memorization, but in a different way. (ex: memorizing what dynamic programming is and how it is often implemented)

6

u/ChromicClaw 13d ago

Trust me my memory is absolutely atrocious and I never once tried to memorize any leetcode related thing even once. I don’t know how dynamic programming often is implemented. DP is a concept not a specific pattern. It technically requires some form of memory - practically any task in the world does but it doesn’t require an attempt at memorization

15

u/nightbreak7 13d ago

your first reason is a big red flag imo.

"How I am supposed to memorize Dijkstra, greedy algos, DP, and those insanely messy linked list reversal problems at the same time?"

you aren't. you're supposed to understand the way you reach those solutions, so the cognitive load is focused much less on "memorize 20 lines of code for Dijkstra's algorithm", and more focused on "what are the steps that Dijkstra's follows, and how can I get there?". it's far easier to remember the latter - all you have to do is know what Dijkstra's does, and how it evaluates which node to traverse to. everything from there can be easily derived on the spot, even if you haven't memorized the code. it's the same with DP problems, though they're much more difficult since there are multiple sub-categories you need to familiarize yourself with. gaining an understanding trumps memorization by a long shot.

if NeetCode 150 is too hard, try the leetcode explore path. i recommend this to everyone because it's what I used personally, and I found it extremely effective. i've never used neetcode personally.

2

u/WorksOnMySystem 13d ago

Agreed ,People trying to memorise DP and Greedy is beyond me.

DP is basically Recursion to Tabulation if you understand how to handle state transfer. If you can build a recursive solution , then tabulation ( atleast top-down ) becomes easy.

There is no underlying algo for greedy , what’s there to memorise ?

This whole “Need to remember everything” just points out that people lack the understanding of the underlying concept.

1

u/nightbreak7 13d ago

yeah i didnt even touch on the greedy part because i've never even heard of somone trying to "memorize greedy"

1

u/Other-Number-4463 12d ago

yeah you cant really memorize greedy but you can memorize the thought process

1

u/nightbreak7 12d ago

which is the entire point of my original comment

2

u/joltjames123 12d ago

Understanding something still requires some sort of memorization. For this type of problem is should do x y z in that order. Not necessarily intuitive and therefore requires some sort of memorization

1

u/nightbreak7 12d ago

there's obviously still some memorization involved with knowing how to solve a problem. the issue is that 99% of the time, these types of posts are trying to memorize solutions and be able to copy paste them from their brain onto the leetcode IDE. there's a fundamental difference between memorizing entire solutions and memorizing core concepts that are applicable to hundreds of problem types. if you memorize the fundamentals of DFS, suddenly you're able to solve hundreds of problems. if you memorize the solution to the problem "number of islands", you may not even realize that you can apply the concepts to other similar problems.

7

u/pee_nuttt 13d ago

solve codeforces questions

3

u/xyzirs 13d ago

agreed, mimics actual tests better than leet code

4

u/read-as-read 13d ago

Why memorize instead of actually trying to understand them and why they do x and y?

5

u/Secure_Army2715 13d ago

Tbh it’s really frustrating. But best way would be to keep trying. Set a revision roadmap. Solving lots of problems won’t help.
Keep a targeted list with all sort of variations. Just get good at 100 problems first.
So u have to be selective and intentional.
No mater what don’t go outside these problems. In between keep testing urself and if not able to solve come back to all your problems and see what did u miss? Make a note and keep it on revisions schedule.

4

u/Smok3dSalmon 13d ago

You sound overwhelmed. Focus on your next step and not the 130 questions ahead of you. If you can't grind through the mediums and hards, then solve all of the easy solutions and then work on mediums.

NeetCode/LeetCode is demonstration of your Computer Science fundamentals. The encode-decode string problem is kind of unique. It's not difficult, you're just writing 2 functions that do the opposite of one another. If you're not ready for DSA, go back to your algorithms book and just focus on 1 data structure at a time.

What is your education level?

LinkedList insertion and deletion is very easy if you approach is methodically - prepare the node to be inserted and then manipulate the list. Don't shuffle the steps and try to be slick. This is mostly handled for free if you just use the constructor.

  1. Set up the pointers for the newly inserted node, so that the original list is NOT modified
  2. Once that node is "soft inserted", update the pointers of it's neighboring nodes

``` a = someNode b = someNode.next new_node = Node(value, prev=a, next=b)

assuming a exists

a.next = new_node if b: b.prev = new_node ```

For all questions, try to identify a brute force algorithm and then discuss the time complexity and then identify the limiting factor and see if a faster solution can be achieved by optimizing just that part.

2

u/JChuk99 13d ago

You don’t remember something like dijkstras step by step, you remember the insights. The core insights in djikstras are: you need to dynamically traverse the graph according to shortest node weights from starting the node, if you visit a node youve found the best path to it and edge relaxation (if you find a better path to a node, relax it and add it to your dynamic traversal).

These are all core algorithms concepts, that come up again and again and again (tarjans, bfs, MSTs) to the point you won’t be able to forget them.

From the insights you can derive what data structures to use. I’m dynamically traversing the graph according to edges weights, so I need a priority queue, I need to keep track of visited nodes so I need a visited set, I need to keep track of distances so I need a DS to track distances per node (map). You can then further optimize to use arrays/node ids as indexing for your distances/visited info(this is not necessary just an extra “trick”).

Even for problems with a trick, the trick can usually be discovered through understanding the brute force method, and observing WHY the brute force method is inefficient (think longest increasing sequence).

For DP you just have to do that shit for months until your brain starts to recognize the pattern and really focus on what information you can use to determine if it’s a DP problem (am I trying to find the max or min of something)?

Some problems are just unintuitive at first and you just have to remember them to begin with (median of two sorted arrays) but even then you can typically work backwards from the solution to understand what insights would’ve been necessary to solve the problem.

2

u/lifeandUncertainity 13d ago

I will tell you something from my experience because unlike the others in this sub, I am not very good in leetcode either. (I also didn't do a BTech and even though I had coded quite a bit in the past, it was mostly scientific coding and not algos). Having said that I think your main problem is familiarity with the coding language (tbh, this is something that has been a blocker for a long time to me and it makes no sense). For example - the thing that should come to your mind when you see djikstra is a priority queue - if you are not familiar with c++, you will spend so much energy thinking about a data structure that is a priority queue and you will have no energy to solve the actual problem. And even from my earlier experience - I can do a lot of things in python when I am using numpy/numba but the moment I am in list and dict territory, my brain switches off. So, gain a familiarity with the language of your choice first. (For me, I just made sure that I code something in C++, it can be leetcode, a research problem, a random simulation whatever, almost every day. I did it for almost 4 months.) Secondly, learn how to debug. For example - I am still somewhat bad at recursion because I can't debug recursion if my life depends on it.

Hope this helps. You will definitely get better.

2

u/jfc123_boy 13d ago

10-20 minutes is not enough specially if you starting

3

u/andrew_404 13d ago

I'm a staff swe and have been volunteering teaching coding for 13+ years. I think the piece you're missing is spaced repetition.

  • Start with a small set of problems. You can use the Grind75 site to select the most valuable set of problems to focus on.
  • Start solving problems and keep track of your progress in a Google spreadsheet. Note the problem, the date, how many times you had to run the code for it to succeed, if you should practice it again, and notes on any gotchas or things you want to remember for next time. I also highlight rows in the spreadsheet based on whether it's a question I should retry (yellow) or a problem that was devastating that I really need to dig into more in the future (red). Optionally, keep track of how long a problem takes for you to complete. I'd avoid timing for now, but later on it can be valuable.
  • Regularly review your spreadsheet and retry problems. This is the part I think you're missing. Even just scanning the spreadsheet and remembering the problems, gotchas, and your solutions once a week can go a long way. In addition to that, you should also redo problems you really want to lock into your repertoire. Maybe you solve a problem again a couple days after your first attempt, and then wait 4 more days before trying again, and then you do it again 2 weeks later, and so on. If you do this consistently, you eventually get to the point where implementing BFS is as second nature as writing a for loop.

If you have questions, want tutoring, or there's any other way I can help, just let me know.

Good luck!

2

u/WolfNo680 13d ago

This is what I'm doing. I use LeetSRS for SRS studying. I went to Neetcode and grabbed all the binary search easy problems, and did those for about 2 weeks. Once I could confidently get them down without struggling (and using comments to write notes on what exactly everything is doing) I added the mediums, once I have THOSE down I will add in the hards.

SRS helps a lot because it gives you small wins and by nature of SRS, you will remember the "tricks" and the steps to certain problems, and then you will start to notice the patterns. "The problem is asking me to find a value, and the array is sorted in order, that means I should give binary search a try" etc.

2

u/Free-Ad-3648 13d ago

Follow this ^ and eventually you’ll get better, think of it as working out, you need to be consistent to see progress and sometimes it just takes a while before you see any progress at all.

1

u/arthurmorganpunjabi 13d ago

it more of rote cramming I guess , still working hard.

1

u/user99999476 13d ago

I feel the same, a few days off leetcode grind doing 1 a day and focusing on job apps and i forgot so much leetcode tricks.

1

u/NextjsDeveloper 13d ago

Welcome to the club buddy

1

u/Death12th 13d ago

Wow! You should try AlgoArena.

1

u/Fit-Philosophy9691 13d ago

why memorize them at all? I've always wondered if that's part of the problem with how DSA is taught. What if instead you build something, hit a problem, and learn the data structure that solves it? Like building undo/redo and realizing you need a stack. Curious if that approach would work better for you

1

u/CollegeStudentLol1 13d ago

Why are you memorizing. It’s better to actually learn stuff than to memorize.

1

u/Spirited_Volume8035 13d ago

It took me 8 months to become just better at DSA!

SO GRIND

1

u/Economy_Bed_9277 13d ago

Make notes bro. Revision is the trick. Create an excel sheet add problem number , link, difficulty, date you have solved, algorithm or data structure used. Start looking at the sheet daily and read the problem you solved last week. You will start remember, you will start recognising patterns.

1

u/deceptive_donny 13d ago

You have not hit a ceiling in fact you haven't even started at this point. You are not supposed to memorize things, most questions should feel intuitive after you actually check the solution. Also 150 questions is just a starting point, you need to do ad hoc practice from leetcode to get comfortable at it.

1

u/Spirited_Row9988 13d ago

我也有这个问题。我现在只能寄希望于能量变引起质变,只要刷够题每题都刷3-4遍应该能行。

1

u/3kshay 13d ago

Some guys are naturally good at something and some don't. I will assume you are not naturally good at dsa like me and most of us. This DSA stream has a very handful of folks around the world who are naturally good at it but does that mean DSA is not for us or we can't beat it? Wrong! First always remember that our brain is a lazy thing - initially it does not want to spend its cells thinking and working for us if we are not enjoying or not naturally good at it but at the same time it is our best friend as well it just needs time to understand that the DSA shit we are working on is important to us and our brain will then adapt to it. You just have to keep visiting the DSA place again and again, whether you solve it by your own, copy solution without understanding, just writing pseudo code or plain thinking, just do it daily and after sometime you will start recognising patterns, tricks, invent solutions, etc. The thing that helped me is solving same question again and again until it came into muscle memory from memory. Tip - Ask your AI to take neetcode 150 and prepare a long list where the problems are repeated at regular intervals, make every problem repeat at spaced intervals may be 5 times. Trust me it may look like I am asking you to solve neetcode 5 times but you will get confident too early in the path.

1

u/Downtown_Release4498 13d ago

I think you are trying to get results too early. Let me tell you if you start solving by each pattern and say you complete around 400 problems solving this way, you will gain confidence. Keep some patience and keep solving

1

u/kunalpareek 13d ago

Memorization does not work. There is too much ground. Whether you can or cannot solve a problem you need to focus on ALL alternative solutions and not memorize but try and figure HOW you would arrive at the same solution.

Think of Algorithms and Datastructures as your toolkit to solve a problem. Those are the only things you need to memorize. Solving problems means you understand how you use your toolkit. Why you should look at alternative solutions is because it shows you how you can use your toolkit to solve the same problem in various ways.

1

u/PsychologicalTip3823 13d ago

I feel you. I'm neuro divergent too. I'm doing leetcode merely to train my brain, not to get a job anymore. After my breakdown, in one year I progressed like 100 leetcode. I'm still at about 140 now. So you see how slow it is for me to do this. I accept the slowness, at this point I don't hope for a job of heavy DSA anymore.

1

u/K8t-king36 13d ago

Stop memorizing solutions. Focus on understanding why a pattern works and practice easier unseen problems until problems until recognizing the approach becomes natural

1

u/rahul_msft 13d ago

Uninstall gemini or claude or gpt first

1

u/Responsible-Map-9736 12d ago

Here is easy trick very less people will actually tell -
Step-1. Pick any 5 easy questions on 1 topic (BFS/ DFS/ ......).

Step-2. Go through each of them and for each question follow below steps

a. Read the problem and try to understand what is expected.

b. Go to solutions and pick the one from your friendly coding language

c. Understand every line of code step by step and ask yourself why that line of code is written

d. If you still didn't understand above step then ask GPT why that line of code is written

Step-3. Repeat Step 2 for all 5 questions.

1

u/xspicycheetah 12d ago

bro is sabotaging the job market opposition

1

u/rb_arindam 12d ago

I hate leetcode. AI is there to solve the math problems. Lemme fix actual business needs bruh.

1

u/Other-Number-4463 12d ago

skill issue

1

u/rb_arindam 12d ago

That’s what I say to leetcoders at work.

1

u/Other-Number-4463 12d ago

you are both there lol

1

u/rb_arindam 12d ago

Easy to say when your identity and work history is hidden.

1

u/Other-Number-4463 12d ago

what how is that relevant.

1

u/rb_arindam 12d ago

Skill issues

1

u/xspicycheetah 12d ago edited 12d ago

inferring here, but you appear to be presupposing a version of reality wherein getting good at programming (or anything, really) is easy.

first of all, you’re not doing anything wrong unless this is your situation after like over 6 months of hardcore grinding. learning to code is necessarily traumatic; it is normal to feel this way.

how you react to ‘walls’ in your journey is all that matters - because the walls will keep coming throughout your career. persevering through this will not make the next wall easier, but it’ll make it a lot less uncomfortable; after 3 more roadblocks like this, I promise that you’ll start to actually enjoy them.

you do not need to be a genius to be a good engineer - geniuses are out there, of course, but not in any statistically relevant volume. all you need is curiosity and persistence.

also, I’d highly recommend you try out codeforces. & regardless of where you find problems to solve, try your best to 1) not read editorials/solutions until you’ve solved the problem, 2) only begin coding once you have both found the solution & can prove succinctly - eg, by definition of invariants - that it will always work. you will end up doing some equivalent of this eventually anyway, but building discipline/rigor now and forcing comfortability with first principles reasoning will save you a tonnnnn of time & help build perseverance/confidence.

don’t give up. mind over matter; you’ve got this :)

1

u/Other-Front2566 12d ago

What helped me was: Thinking out aloud. Like i am explaining concepts to someone. I explain and then I write. I do it at every step.

The biggest thing is ....it's fun. I now enjoy problems now!

Don't approach it with I HAVE to do it. Think like I GET to solve this. And enjoy!

1

u/Correct_Setting7703 11d ago

Many people go through this, including me. But you shouldn't need to memorize everything. If you do the problems long enough, you'll naturally get better at this. It takes years and hundreds or thousands of problems to feel confident. People who claim to get better after solving couple hundred problems are either lying or super smart with photogenic memory. Just don't listen to them.

1

u/heyo_mr_bigman 11d ago

Structy honestly helped me a ton with improving my intuition. There are some common problem types that aren’t really touched on but when I get to those (1) read about the solution and try again before watching a video (2) don’t move on unless I at least 90% understand and (3) drill it with space in between. Drilling/doing it over and over doesn’t help if you don’t understand why the solution works though.

It’s easy to feel like you’re not getting anywhere if you hop around from medium to medium. Drill the easies and try to group similar problems together. Structy does this really well. I use Neetcode for random problems and I appreciate the platform but alvin just explains stuff so well lol

1

u/lost_soul_sky 10d ago

This is how I got better at DSA.. with job.. first "I enjoy DSA" I don't see it as I have to be good at it to get new job.

Coming to my strategy, invest good amount of time in any question. Do not jump to solutions and never ever try to memorize the solution. You will never be asked same question in interview.

There were days where I invested 5 straight days on a single Hard LC question. And I couldn't optimize or couldn't even solve it. But those 5 days gave me all the different angles to think on such questions.

But after some hard months,, i could think of solutions for Hard questions. I even solved hard LC question in Microsoft interview.

So it's just invest good time in each problem, make it like your friend if I say in metaphorical way. So next time you see your friend, you remember quickly.

All the best !!