Leetcode Paradox?

Intel iverso
Mar 7 36 Comments

I've interviewed at Google and Facebook before and bombed it. I used MIT OCW Introduction to Algorithms and some CLRS to prepare. This was before I heard about Leetcode.

Now I see that Leetcode is the most popular place to practice for interviews, and that the ability to solve 2 problems in 45 minutes is not unheard of from FANG.

I've been contacted by Google and Facebook again, and I'm using Leetcode now but I sense a weird paradox here. Many Leetcode problems, especially dynamic programming ones, cannot be reasonably derived and implemented in 45 minutes. In fact, my team recently implemented an optimization feature using DP that took a least 3 hours of meetings and a few days of programming to solve and get right.

Modern interviews seem to be more about optimal pattern matching for specific classes of problems than problem solving for day to day work. I'm thinking the best way to prepare using Leetcode may be to internalize the solutions to each class of problem, then continuously try to reimplement from scratch until you can't get it wrong. What do you think?

TL;DR: The best way to use Leetcode is to internalize the solution to problems, then continuously try to solve them only using active recall.

comments

Want to comment? LOG IN or SIGN UP
TOP 36 Comments
  • Facebook Probe
    Kinda obvious isn't it? What, you actually think someone could implement an LRU cache in 45 min seeing it for the first time? Or that people come up with the brilliant idea to use fast/slow pointers for cycle detection while holding a whiteboard marker? lmao
    Mar 7 10
    • Hotwire rpdI04
      The correlation is that Google found competitive coders to be sucking at their job, because of a lack of reflective style of thinking. I read something like this, a long time ago. Google it.
      Mar 7
    • Google Bdjdjxhcsj
      lol no wonder you are at Hotwire with that reading comprehension
      Mar 7
    • Hotwire rpdI04
      It's not so much about where you are, but who you are. Wish someone could flaunt this attitude inside Hotwire. It's already full of people who are so full of themselves that I've been attempting to escape ever since I joined.
      Mar 7
    • Intel UGeJ58
      ^Dont let G's self hatred affect you man.

      Angry people on the inside are the same outside

      Happy people on the inside are the same outside
      Mar 8
    • Bloomberg EVALSlayer
      I implemented LRU Cache in less than 45 minutes and it was the first leetcode problem I ever did. Just saying since you asked. On the other hand I couldn’t figure out backtracking when I saw it for the first time being ~9 years out of college. I looked at the solution and then remembered all those chess and boggle problems I did in CS106B.
      There are people out there that will figure out a lot more than me in the first try.
      Apr 8
  • Google / Eng
    euos

    Google Eng

    PRE
    Nvidia, Nokia
    euosmore
    Many Googlers feel like we got in by sheer luck. Three of my interviewers asked me very similar question, I am pretty sure I would fail an interview otherwise.

    What I like even more is the fact that I bombed a Twitter phone screen the week I passed Google interview. Either Twitter is much more demanding or those interviews do not reflect with engineering ability.
    Mar 7 4
    • Google aiqqu
      I don’t think either of your conclusions are true. They do reflect some engineering ability of course but there is a luck component in terms of what questions you receive. With phone screens especially as it’s usually just one question.
      Mar 7
    • Google EKAB20
      *Many* Googlers would be a gross generalization, and most likely untrue. Some yes, many, not sure.
      Mar 7
    • Google / Eng
      euos

      Google Eng

      PRE
      Nvidia, Nokia
      euosmore
      Ok, I was discussing this mostly with L5+ Googlers, with many people being with Google for 3+ years. I expect that junior SWEs that did interview less then year ago feel much more confident.
      Mar 7
    • Google EKAB20
      I see. Still, I'd say a small sample set to conclude from. I've been at Google for 7+ years, and while I've heard people say that, I don't think it's a majority. But again, either of us would need hard data to refute each other, so I'd refrain from making any generalization myself!
      Mar 7
  • Oath newJoine
    It’s an unfair world . You need to adapt. I agree with you. But if you don’t go with the flow, some loser will get that job because he had memorized the solution and could do two questions in 45 mins
    Mar 7 0
  • MathWorks cJ8oNw
    I dont get it. None of the interview rounds I had recently were ridiculous LC hard questions (including Google interviews). All of them were reasonable problems with often times multiple approaches for solutions. Very few of the problems were the type of problem that requires some genius intuition or application of algorithms.

    I either got lucky or people overstate things often. I went through close to 30 rounds of interviews, so I think it's the latter.
    Mar 7 5
    • Cisco / Eng acqui
      I recently cleared G and F phone screens. Questions were pretty easy, I saw them for the first time and was able to code up soln easily. No LC questions AFAIK. In F, I was asked 3 questions, the 3rd was a little hard, still not hard like you see in LC. When the interviewer saw me struggling, he gave me hints which easily led to the soln. The fact that I cleared means it is ok to take hints and he did not take it negatively that I had coded a fix based on hints provided. Similar experiences with other companies, all easy questions.

      Did you finish onsite? Are questions asked onsite the same difficulty as phone screens. I am yet to do onsite so wanted to understand the expectations.
      Mar 7
    • MathWorks cJ8oNw
      I didn't do Facebook onsite so I don't know about them but for Google, my onsites were definitely harder than my phonescreen. I got an LC medium on phone screen (literally exact same problem as one on LC), but none of the onsite questions were on LC, and they were also a bit different in terms of style of questions. More complex, multiple layers to the problem, etc.
      Mar 7
    • Cisco / Eng acqui
      Did u clear G onsite?
      Mar 7
    • MathWorks cJ8oNw
      Yes
      Mar 7
    • Salesforce Belgium
      @mathworks but did you solve LC at all? If yes, how many?
      Mar 7
  • Travelport / Eng buttnpushr
    There is no paradox there. A 10x code monkey has memorized solutions to 100 times more problem patterns than a plebxer who thinks she is real people and tries to think about developing solutions (lol they believe they can think so cute).

    So go on code monkeys. Move fast and break things. Those code mines aren't going to dig themselves
    Mar 7 0
  • Walmart.com / Eng äččä
    That is correct. The person must be seriously talented if he/she can solve streaming median, max path sum in a binary tree, trapping rain water etc. just by reading heaps, trees and arrays from CLRS. Nowadays it’s all about recognizing patterns and in case of hard problems remembering solutions.

    However, I recently gave onsite interviews for Uber, Google, Apple and a bunch of other smaller companies, I don’t recall a single LC hard. I think companies are also learning.
    Mar 7 7
    • Walmart.com / Eng äččä
      The questions were some tweaks on standard algorithms like BFS, DFS, two pointer type problems etc. I think that’s fair. There was always one round (kind of like bar raiser) where the problem was vague and I am supposed to figure out the requirements.
      Mar 7
    • Salesforce Stanford2
      Walmart, did you get any offers?
      Mar 7
    • Goldman Sachs abcdeaa
      I got asked 2 LC hards in both coding rounds at Uber
      Mar 8
    • Credit Karma WRra32
      Trapping rain water 1 is trivial for any individual with a technical background (it should be a medium at max). Trapping rain water 2 is challenging for a non-CS background.
      Mar 8
    • I got LC hard at Oscar and Compass. Regular expression matcher and largest rectangle in histogram.
      Mar 8
  • VMware wewish
    Thats why asking problems as is from leetcode doesn’t tell whether interviewee is genuine. I tweak problem and then boom sometimes it takes next 30 mins figuring out how part and then the real interview start.
    Mar 7 0
  • Microsoft eRSF87
    How is this a surprise?
    Life is about pattern matching.
    Everything you do is:
    1) be in a situation
    2) match it to what you have seen in your life before
    3) act based on your experience
    Mar 7 1
    • Walmart.com / Eng review
      This is a very broad generalization but anyway, we don’t:

      1. Act in 45 mins
      2. Are not expected to solve two situations in 45 mins
      3. Are not always expected to come up with the optimal solution because no one knows what that is
      4. Are not the only ones not knowing the solution, so for the other person too the problem is equally hard
      5. Can seek help from internet, people etc.
      6. Are not competing with others who have been in a similar situation already
      7. Are able to get feedback if we fail so we can improve

      Add if anyone knows more!
      Mar 7
  • Airbnb / Eng caudex
    You’re basically expected to memorize a bunch of algorithms, or at least the common parts.
    Mar 7 0