Tech IndustryApr 25, 2019
CimpressGBmf58

How many people actually think up the fast LeetCode hard answers the first time?

I have been doing leetcode hard questions for practice. I generally quickly think up a solution, and get it programmed with minimal errors. But often I am getting non-ideal runtimes, and the given solutions are faster. Things like mine being N^2 rather than their NlogN ones. I usually realize that there is a faster method, but can't exactly figure it what the trick is. How often does the first solution you actually code up match the suggested solutions?

Poll
125 Participants
Select only one answer
New
uedC03 Apr 25, 2019

Dig into the algos, and practice them seperate of lc. After enough lc problems the solutions become clear. Sometimes there is no effecient solution

New
uedC03 Apr 25, 2019

I spent 12 hours a day leetcoding though, im so burned out. It took me a few days to get comfortable with dp problems and a few weeks to retain it. I would also practice on the white board, google docs, pen and paper, and always talk out loud to myself. Timing yourself is helpful as well

Goldman Sachs pakalu Apr 25, 2019

Where are u now?

Clearstream.TV restandves Apr 26, 2019

Leetcode hards are impossible. I think I’m too stupid. I’ve been leetcoding for 4 months straight already

Castlight Health whaaaaaat Apr 26, 2019

I like the idea of putting a leetcode hard problem in my head and just thinking about it. I don't have time to sit down and actually spend time leetcoding. So far I've only tried this with one problem, which I started yesterday, the LRU cache in constant time. Really interesting. Great to think about. So far I've managed to figure out the requirements for doing it in constant time, but not sure how to actually write it yet. Can easily think of several implementations for linear time though. Even though it's in my head I've maybe only spent 15 minutes here and there really thinking about it. Not sure you could do one of these in 30 minutes without practicing algorithms a lot for maybe a few months before interviewing. And having the experience in advance of that as well.

Quora eNHU01 Apr 26, 2019

Getting LC hards first attempt, 20 minutes ish is good enough to get top 200 or so in weekly contests.

New
uedC03 Apr 26, 2019

Nice! i always struggle In contests, ive been getting better