2 ms·
There are already lots of good advices and recommendations, but I still would like to add my own experience. I have an non-CS engineering degree, so before I di
by panda88888 6y ago
There are already lots of good advices and recommendations, but I still would like to add my own experience. I have an non-CS engineering degree, so before I did any interview prep, I bought the CLRS algorithm textbook and self-studied everything up to and including graphs/dynamic programming, which are the topics a typical whiteboard interview covers. This includes not just reading, but actually implementations and test harnesses for each of the data structures. I used Python.
Next, with the basics covered, I worked through both Cracking the Coding Interview and Elements of Programming Interview in Python. I worked out each problem in a paper notebook with pencil, talked to myself explaining my approaches, and checked my handwritten code with a computer after I am done. This further cemented my sense of how to approach problems.
Last, I worked through leetcode problems. This step is identical to another fellow HNer’s comment on chess and deliberate practice. I worked on a few (3, at most 4) problems a day. For each problem, I treat it as a real interview and talked to myself out loud.
1) I repeat the problem and stated assumptions
2) I explained my approach and reasonings on selecting any particular algorithm/data structure
3) I outlined with pseudo code and identified any edge cases
4) I walked through my algorithm using simple example as a a quick check
5) Only then did I start to write code, on paper with a pencil.
6) After I’ve written the code, I walk through the code again with a simple example as well as the edge cases identified in step 3 to verify I handled them.
7) Finally, this is where I actually use the leetcode website. I type my code exactly as written and submit it to make sure it passes.
The goal I set for myself is that for Easy questions, I should be able to do this in under 15-20 minutes (exclude typing code into leetcode) and pass in a single attempt. For Medium questions, I gave myself 35-40 minutes and maybe 2 attempts. For Hard questions, it’s up to 55 minutes and not necessarily pass (basically I am ok with failing hard questions).
I was able to pass the tech interview at Google.
The CLR portion took a few months (I don’t remember exactly how long). The Cracking the Coding Interview/Elements of Programming Interview in Python is maybe 1 month. Leetcode portion is maybe 2 months, give or take a few weeks.
I hope this helps you.