Leetcode; how much time to invest in each problem?
May 24, 2020
6 Comments
Looking to apply at FAANG in the coming months once I get some LC practice in.
I can solve easy/medium. Although I keep time and space complexity in mind, my solution is rarely optimal based on the discussions I see in the forums. I usually just make sure it passes, then peek at the solutions/discussions.
How much time should I be investing in each problem? Should I be trying to understand the most optimal solution for each if I didn't get it? Finally, do interviewers expect optimal solutions right off the bat?
#leetcode #faang
comments
I read this from a random guy on leetcode and he hit home
Facebook interviews are ripped straight off of leetcode, and then they have the audacity to ask if you have seen the problem before. I’m curious if anyone out there is admitting to having seen the problem. The trick is to ask them to repeat the problem a few times as if you have no idea what they’re talking about, and then ask them to run through a quick example for you. Then just go ahead and type out the code that you already have memorized.
Best solution at the beginning is not necessary. It's also not the end of the world to not get the most optimal time complexity by the end, but your interviewer will/should nudge you as needed and you should be observant of that. That said to be competitive you should have the most optimal time complexity solution (or at the very least verbalize it clearly if out of time), and you *absolutely* should understand the most optimal solution when practicing. Space complexity is nice to know. Don't stop the grind ✌️