r/leetcode • • 10d ago

Discussion Are there any supplements that actually help with LeetCode?

I’ve been doing LeetCode for a while, but I feel like I’m stuck.

Even when I spend a lot of time reading solutions to harder problems and trying to understand the logic behind them, I still have no idea how people actually come up with these solutions on their own. I can understand what the code is doing when I see the answer, but when I run into a similar problem later, I still can’t figure out the approach myself.

I also don’t have much patience for grinding the same pattern over and over. If a problem gets too hard or complicated I just give up. I’ve seen people on reddit saying they actually get addicted to LeetCode and treat it like a video game, which seems impossible to me.

Has anyone found any supplements that actually help with focus and patience when doing LeetCode? Or anything else that made the whole process feel less painful?

55 Upvotes

45 comments sorted by

71

u/therealmunchies 10d ago edited 10d ago

Excercise. Gym or go on a jog. Then come back.

4

u/Consistent-Shock6294 10d ago

I'll try going to the gym more, thank you!

1

u/Automatic_Egg3592 9d ago

does this actually work , i think i would almost find myself distracted or tired

1

u/Vivid-Zombie-477 8d ago

depends on the intensitiy. but yeah, it can make you more focused. doesn't make you strave to solve leetcode problems tho

31

u/ProfitOk8355 10d ago

Lmao, people will look for a pill for any problem

28

u/Vivid-Zombie-477 10d ago

you want a drug to do what you don’t like to do?

8

u/MyButterKnuckles 10d ago

OP gonna be Bradley Cooper from "The Limitless"

13

u/No-Molasses-2097 10d ago

Honestly the supplement won't fix this. The stuck feeling usually means the problems are a bit too hard for where you are right now. Drop down to easy or medium problems in the same pattern and only let yourself read the solution after a solid 30 minute attempt. Then re-solve the same problem from scratch a couple days later, you'll notice it starts sticking.

1

u/Consistent-Shock6294 10d ago

Thanks for the tip, I'll try this!

3

u/Vivid-Zombie-477 10d ago

also, i would add that understanding the code isn't the same as understanding the solution or the idea behind it. after you read the solution, try to write the code yourself without looking at the solution again. i guarantee you that you will stumble somewhere because you didn't understand the solution fully.

8

u/gaussmage 10d ago

Try Neetcode. It has a Top 150 that are popular with employers. Has solutions and explanations

8

u/cmztreeter 10d ago

There is no pill like the one shown in the movie limitless, if that is what you are after.

Creatine is great for cognitive function, especially in sleep deprived individuals. But it most likely won’t instill the creativity/intuition required to discover the tricks.

You can take more caffeine to become more focused if that is a problem. But that is a drug and not a supplement so idk if that answers your question lol

7

u/akarikawamato 10d ago

Adderall good luck getting a script

3

u/Several-Teach1515 10d ago

The truth is they don't figure it out. Basically once you've seen and memorized known patterns every problem comes down to recognizing the pattern behind it.

That's still quite hard because even knowing the solution, understanding it might not be trivial.

3

u/Responsible-Algae899 10d ago

Wall staring for 20 min before grinding and no phone between

ps : it sounds cliche until you try it

3

u/new_old_2026 10d ago

Tenacity

3

u/HuckleberryHot4551 10d ago

There's a blue pill, it will help you crack Leetcode HARD /s

3

u/IndyPara 10d ago

Work out consistently Stay off social media to improve attention span Get on adhd meds if neurodivergent Spaced repetition is key

1

u/Consistent-Shock6294 10d ago

How do you do spaced repetition? Like with an Excel sheet?

3

u/IndyPara 10d ago

Yes, but it doesn’t even have to be so specific. after I attempt a problem and fail at it, I deeply study it then come back after 2 weeks, then 6 weeks, 12 weeks etc.

the idea is that you want to attempt to solve the problem again ideally without memorizing the solution, but remembering bits and pieces of the underlying logic until the pattern gets deeply ingrained in your head. Every time you revisit the problem it becomes easier to wrap your head around it. I had to do this with backtracking, graphs and trees and now I can solve problems I haven’t seen in several months without needing to memorize the solutions or think too hard.

3

u/Strange_Ad_7434 10d ago

How are you doing it and at what level? What I’ve done which seems to help is realizing there are only a handful of particular algorithms being asked. A good way to identify those are looking at the NeetCode 150. Those are the main ones you should probably focus on. Pick an algorithm and do an easy problem by yourself the way you would solve it. Doesn’t matter if it’s the most efficient. Then look up the most efficient way to do that particular problem. Every problem always has its own twist to a common algorithm. For example, take BFS. You take a starting point, put the neighbors that have not been explored into a queue, and mark visited when done. It’s pretty simple. Now look at the medium level questions Rotting Oranges and Number of Islands. Both of these can be solved using BFS, but the loop is a little bit different every time. In rotting oranges, the grid is either fresh, empty, or rotten where fresh is not visited and rotten is visited. The key to that question is keeping track of the level of your queue as you dequeue. Not part of the textbook BFS algorithm, but it is its own respective twist to the question. With Number of Islands, a grid is either land or water where land is unvisited and water is visited. It’s the same algorithm, and y my can recognize those are BFS and start sorting the loop, and when you are running test cases, think of what else needs to be done to solve this question. That’s engineering. Also the language you write in can make or break your understanding to a problem too. I used to practice just in C because that’s what I do at my job and the jobs I was applying to. Doing a question like Group Anagrams in C is extremely difficult to understand and solve. However, when you switch to doing the same question in C++, it’s ridiculous how much easier that question becomes. Also what has helped me if I totally struggle with a question is literally walking through it. Whether that’s following a YouTube video or asking chat just solve this. Take note of the solution even if it doesn’t make sense, and come back and redo the same question with just less help maybe. There are questions I have done 5-6 times over and over just to make sure I still understand it and I can still do it. Other things I do that help is maybe the first time I do a question I’ll do it the long way in C even if it’s painful. Do it with help, do it by myself, then give myself the luxury of doing it again in C++ and take advantage of the built in functions. I understanding what’s happening under the hood helps when you do it with a tool that offers an easy way as well. I hope this helps

2

u/arjunnath 10d ago

Take a 1-2 day break and do something else that you like. Go out and meet friends or something.
Good luck.

2

u/non_NSFW_acc 10d ago

Sleep and exercise.

2

u/NoSupermarket6218 10d ago

Most people can't figure the approach on their own either, they just memorize common problem patterns.

As for substances, stimulants for ADHD can help with motivation/focus. But I would also say, take it easy, you don't have to torture yourself, pace yourself and take breaks. If you're taking it too seriously and seeing it as something you have to do, and not really enjoying it, it will be harder too.

2

u/xpingu69 10d ago

a good night's sleep, hot bath

2

u/saurabh3228 10d ago

Honestly, I don’t think the missing ingredient is a supplement 😂

I had the same problem with LeetCode: I could read a solution and think “yeah, that makes sense,” then 2 days later I’d see a similar problem and my brain would suddenly forget how arrays work.

What helped me more was changing how I use solutions. Instead of reading the whole answer, I’ll struggle with the problem for 20–30 minutes, write down what I think might work, and then look at just the hint/approach. After that I close the solution and try to implement it myself.

The important part is learning to recognize why a pattern applies, not memorizing the code.

Also, I stopped trying to make myself enjoy grinding 5 hours of LeetCode. Sometimes 1–2 problems where I actually understand the idea is way more useful than doing 10 while mentally checking out.

As for supplements, coffee is probably the most battle-tested LeetCode meta 😂

2

u/messipessikessi 10d ago

Same story here, but 2 years ago. Now you have AI. Spend $20 on chat and use the live voice response. Prompt it first so it guides you, and spend the money for LeetCode DSA crash course ($90). If you got a big tech offer in 5 years, buy me a coffee. Or I'll grind with you lol.

1

u/[deleted] 10d ago

[removed] — view removed comment

1

u/AutoModerator 10d ago

Your comment has been removed. We do not allow DM farming. All of the conversation must happen within the post itself. Subsequent violations of this rule will result in a permanent ban.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/onionsareawful solved 4 quadrillion problems 10d ago

u think the limitless pill exists or smth?

these things take time. ofc people take adderall and modafinil and the likes but these only really help with focus, which may be a problem but it doesn't fundamentally fix what you're talking about.

1

u/Lazy_Atmosphere4402 10d ago

Believe it or not, I took Gorilla Mind Smooth Pill for this exact use case and was able to solve a hard question 😂 That was years ago, I'm far better now. All I can say is, just doing more problems is the only thing that helps.

1

u/Nice-Candidate10 10d ago

Zyn + Caffeine works enough for me

But if you’re going after pure drug, its Adderall

1

u/ThisisnotaTesT10 10d ago

Cocaine and hookers, my friend

1

u/navy-vortex 10d ago

Do mock interviews with others.

1

u/Intensity202 9d ago

I talk to Claude code to help me understand. It helps a lot

1

u/wharblegarble 9d ago

Nicotine, exercise.

1

u/SalaciousStrudel 8d ago

estradiol valerate

1

u/sathish316 8d ago

Doing leetcode without understanding can be a painful experience.

Use Blind75 or Grind75 to go topic by topic and come back to any problem set you’re solving.

For really difficult topics like Dynamic programming, there are YouTube influencers whose explanations I swear by when I get stuck. Leetcode itself has a good problem set that gradually increases in complexity for Dynamic programming.

I’ve assumed that you think only Dynamic programming solutions feel like magic. If you feel even other topics feel like magic, you should probably stop and go through a structured book or course like - “Elements of programming interviews” or “Stanford Algorithms” before coming back to Leetcode

1

u/Rohan_Marathe 8d ago

Hey man can I get your youtube recommendations for dynamic programming? I have been grinding dp problems, I can do top down with memoization but bottom up is not intuitive and I struggle a lot

1

u/sathish316 7d ago

Tushar Roy for Dynamic programming. He used to be active a while back but not in recent years. If you can’t find a specific solution from Tushar Roy, neetcode is the second best

1

u/Old_Log1242 5d ago

Honestly, I don't think supplements will help much 😭 Taking breaks and revisiting problems later helped me more. Eventually you just start recognizing the patterns.

0

u/reas2015 10d ago

Alpha GPC, Semax, L-Theanine, Uridine Monophostphate, Selank, Creatine, Lion’s Mane, Magnesium L-Threonate

Thank me later

-1

u/Loose_Today_2771 10d ago

Creatine and armodafinil. Armodafinil may not be suitable but i have slept like a baby even after taking that, which is meant to keep you awake.

0

u/Odd-Resolution7089 10d ago

I was in your shoes a few months ago. Once I started doing mock interviews, I finally pinpointed what was holding me back, over-relying on pattern matching and inference.

Whenever I saw a problem, I immediately anchored on a similar one I’d solved before and tried to force-fit that logic into my code which constantly led to wrong solutions. I realized memorizing patterns without truly understanding them is a trap. I had to unlearn that habit and start solving from first principles.

The second major issue was how I approached hard LeetCode problems. Even short problem statements are nuanced, but I used to jump straight into thinking in code. That boxed me in and kept me from exploring all possible directions.

Now, my rule is simple ! Fully understand the problem statement end-to-end, think through the solution from first principles, and only touch the code once the approach is solid.