How to Prepare for Coding Interviews?
A guide of timeline and resources for your coding interview preparation.
Note: This article is Part 1/2 of the Coding Interview series. Part 2 on How to Answer a Coding Interview Question can be found here.
Coding interviews are an essential part of various software-related positions such as software engineer, machine learning engineer, data scientist, etc. Most companies use coding for technical screening. This means that if you are not able to code well, they will not be moving forward with your interview process. Earlier this year, when I was applying for various ML engineer positions, nearly 85% of my initial technical screening interviews consisted of coding rounds.
Using coding as a part of your daily work does not guarantee that you will perform well in these coding interviews. A proper study plan (spanning a few weeks at least) is required to make yourself familiar with the type of coding questions asked in the interview. In this article, I will try to
1. The timeline:
One of the most important factors towards the successful preparation of your coding interviews is your timeline. Give yourself enough time for the preparation. Don’t rely on your daily coding skills. For beginners, at least 2 months of coding preparation is recommended. Make sure you start preparing for coding interviews before applying or scheduling your interviews to give yourself enough time for the preparation. For a new college graduate, a typical timeline is shown below
2. Review Data structures and Complexities:
Before your start practice for coding questions, make sure you are familiar with the most basic data structures used in a coding interview. Most of the coding questions aim at selecting the right data structure. Spend some time going through their basics, available functions, and how to use them. The most commonly used data structures are
- Lists/Arrays
- Linked Lists
- Hash Tables/Dictionaries
- Queues
- Stacks
- Trees
- Graphs
Multiple resources provide in-depth tutorials on these data structures such as the article below:
More detailed information can be found at GeeksForGeeks, Programmiz, FreeCode Camp. Make sure you understand these data structures completely as picking the right data structure for the underlying problem, often is the most important part.
3. Practice coding questions:
The most important part of preparing for a successful coding interview is to practice it as much as you can. If you have not prepared for coding interviews in a while, be ready to spend at least one month on it. A suggested preparation time is 2–3 months for beginners, while for intermediates one month should be sufficient. There are multiple resources that provide a pool of questions that can be solved such as HackerRank and LeetCode. Practicing on these online resources helps you understand the nature of questions usually asked in a coding interview.
Practice Problems Online
There are numerous online resources available that help you practice coding problems such as LeetCode, InterviewBit, HackerRank, etc. Make sure that you make the most out of them. Pick one online resource and aim for easy and medium coding questions (approx. 100–120). Try solving at least 5–10 new problems per week. Beginners should start preparing at least 2–3 months before the interview, and intermediates about 1 month. From my personal experience, I found the paid subscription of LeetCode to be the most useful. Preparing Facebook, Uber, Google, and Microsoft tagged questions of LeetCode (paid subscription) most of the time covers ~70% of the questions asked in the coding interviews.
Keep Notes of your Preparation
Make sure you keep notes of important coding snippets that will come in handy closer to your interview. These notes can include things such as time/space complexity of data structures, language-specific hints, data structures preferred certain groups of problems, etc. Basically creating a cheatsheet from your preparation and what you think might help you to revise for the interview.
An example cheatsheet can be found here: https://github.com/TSiege/Tech-Interview-Cheat-Sheet
Practice Mock Interviews
In order to get yourself familiarized with the interview setting, make sure that you set up mock interviews. Pair up with someone who is preparing for the coding interview and ask them to interview you. Such mock interviews will help you with time management and your comfort level for such a sitting. Moreover, you can also get useful feedback if you were going too fast, if you speak too fast, if you explain too much or too little, etc. You can practice the following guide/template to answer a coding question during your mock interviews so that you get used to it for the actual interview
You can find more details about this template in the article below
Summary
Preparing for coding interviews requires time and patience. You need to be aware of a realistic timeline and available resources. Dedicate sometime weekly to practice coding problems online. The more you practice, the more comfortable you will be during the actual interview.
If this article was helpful to you or you want to learn more about Machine Learning and Data Science, follow Aqeel Anwar, or connect with me on LinkedIn or Twitter. You can also subscribe to my mailing list.