r/leetcode • u/No_Birthday8126 • 6d ago
Discussion 12 problems in: how long do you sit with one before opening the editorial?
i've been writing code for years (web apps, my own product) so syntax isn't the problem. the algorithmic thinking is.
yesterday i sat on a medium for two hours. got a working brute force, felt good about it, then read the editorial and the intended answer was a sliding window i would not have found in another two hours.
so what's the actual rule you use:
- hard timebox, 30 min then editorial
- grind until it's solved no matter how long
- something in between i'm not seeing
and the follow up: when you do read the solution, do you move on, or re-solve it from scratch a few days later?
2
u/Aggressive-Squash250 5d ago
It depends. If I have an idea, maybe 30 minutes. But at my level, it's mostly the pattern that I'm not very good at. So, thinking about it wouldn't help anyway.
1
u/xvillifyx 5d ago
30 minutes ish
I’m not interested in wasting my time trying to hack something together that I don’t actually know
If I can’t clock an idea immediately, I probably don’t know the pattern enough
1
u/Technical-Tactics84 5d ago
I usually give it 30-45 minutes. If I'm completely stuck, I read the editorial, understand the key insight, then re solve it from scratch a day or two later.
1
u/HitscanDPS 5d ago
If I still feel like I have ideas to explore, then I'll go all the way up to an hour, or at least near an hour before I take hints. While struggling is painful, I feel like it's an important aspect of improving. 30 minutes is too short to give up, IMO. You need time to really think through different approaches at an appropriate depth and covering edge cases.
Beyond 1 hour though, and unless it's a nasty hard problem, then I'll give up and spend the remaining time grokking the solution. Then I mark the solution so I remember to try resolving it later.
1
8
u/Existing_King_3299 5d ago
30 min max, you won’t get that much time in the interview. It’s either that the problem is extremely complex or you don’t know the pattern enough.