4 ms·
I worked at 2 FAANGs for 8 years. I did not do a single leetcode problem on purpose. I read Algorithms by Sedgewick and How to Crack the Coding Interview. At le
by optymizer 5y ago
I worked at 2 FAANGs for 8 years. I did not do a single leetcode problem on purpose. I read Algorithms by Sedgewick and How to Crack the Coding Interview. At least on 2 occasions the interviewer gave me a problem that was straight from the latter book and not an exercise, i.e. it was walked through step by step at the beginning of the chapter, and the rest were very similar to the exercises in the book, so I'd say it's not a requirement to go through leetcode, with the caveat below, but you should at least expose yourself to them.
In my experience interviewing, doing leetcode problems gives you a distinct advantage over people who haven't, like me. I did much better on problems that I have encountered in the books (even if I didn't recall the solution exactly) than on completely new types of problems, so, by induction, if you work through as many problems as possible you'll perform better at the coding interview (the leetcode-style ones).
That's the trick to performing well in these interviews. It's unlikely you'll come up with a double-pointer list traversal method in 30 minutes on your own (maybe with a lot of help from the interviewer), because that's a clever way of solving a problem and clever solutions are non-obvious by definition. It takes time to invent an entirely new solution in your mind, but if you know about it and other clever solutions like it, you have a bigger bag of solutions to match to the problem at hand, which is a distinct advantage when interviewing.
You could argue that you should be able to come up with a solution to these problems in less than 30 minutes all on your own, but when the interviewers are calibrated on the other people who have interviewed before you, the majority of which trained on leetcode problems, were exposed to that problem category and it took them much less time to solve it, then you look like an outlier, even if there's nothing wrong with your problem solving abilities. This translates to the interviewer expecting to work through 2 problems in the 30-40 minutes, because that's what the majority of his other leetcode-trained candidates were able to do, so you performed worse than your peers, even if you found the solution in ~30 minutes.
In my opinion, there's value in knowing about these algorithms, in general, to be able to recognize situations when they might apply, but there's little value in being able to know them all so well that we should be able to code the algorithms on a whiteboard under time pressure.