/interview-prep

Notes on preparing for coding interviews during my PhD

Primary LanguagePython

Coding interview prep

Coming from a mathematics background with limited academic coding training, I discovered that internships at companies that I was interested in relied on coding interviews for recruitement, including for research positions during my PhD.

Although I code a significant part of the day for my research, preparing for the coding interviews is an entirely different, and very specific exercise.

While preparing for coding interviews, I kept notes of useful (to me!): resources, comments and code snippets.

I successfully passed the interviews for Google and Facebook internships 4 months appart, and I found myself giving advice to other PhD students about how to prepare for coding interviews.

A targetted search will show that there are a lot of great resources for preparing the coding interviews ! This is a collection of resources that I subectively found useful.

How I prepared

For the Google interviews I had roughly the following preparation:

  • 1/2 days of finding good resources
  • ~5 weeks during which I practiced for ~1h-1h30 every morning and 3-5 hours per day on weekends

What I knew before starting

I did not start from zero:

Before preparing for the Google interviews (2 years before) I had read a part of Cracking the Coding Interview, the whole introduction, and at several exercises (with solutions) per chapter.

This means I was already at least somewhat familiar with most basic data structures (lists, linked-lists, stacks, trees, ...).

Learn about data structures, algorithms

Practice interview questions

  • Geeks for Geeks top 10 algorithms in interview questions
    • I cycled through questions for each chapter, to make sure I had a similar coverage of all the topics
  • LeetCode
    • I payed for the Premium account, and sorted the questions by frequency for the company I was targetting
    • I did maybe ~30% easy, 60% medium, 10% hard questions, and would stop when the code would pass the tests
    • Given that for Google you are coding in a Google doc, I would read the question in LeetCode, then write the code in a GDoc, and then copy-paste the code in LeetCode to pass it through the tests
    • Leetcode also has a mock interview mode that is timed and provides a set of 2/3 questions which I found useful because it is closer to the real interview setting (you don't know in advance if the question is hard or not, which I find is an important prior knowldege which you don't get during the real interview, and a timer)
    • I would try to solve them in real-conditions, including often speaking to an imaginary interviewer aloud in front of my computer (talking and solving the problem at the same time required some practice)
  • I did not solve problems from Cracking the Coding Interview at this time, but I did go through my notes on the exercises I had solved previously to refresh my memory on these classical exercises
  • I also liked the following list from the Tech Interview Handbook although I didn't follow their suggested exercise list

Last minute tips