A recruiter calls you for a position with your dream company. You get extremely excited and ask about their recruiting process. He replies saying “Its nothing big, you will have 5 coding rounds with our senior tech team, just the standard whiteboard coding round”. You blatantly lie and end the conversation by saying you love your current job and will try again at a later point in time. If you can relate to this situation please keep reading.
I have met so many top class software developers who are smart, resourceful, reliable and know the knack of getting the job done despite a lot of dependencies. But the mere thought of whiteboard coding interviews strikes fear in their hearts. Most of these people believe that they can never crack such type of interviews and it is only for the rockstar kids who do competitive programming from age 12. Nothing is farther from the truth. I would like to bust such myths and show you a clear path to clearing these interviews.
First, we need to understand why companies conduct these types of interviews.
- Strong Filter to get good employees — The people who clear coding interviews can be of two types. 1. The extremely smart people who do not need any preparation and can clear such interviews on the fly. The people who take time to prepare and practice DS and algorithms and clear the interviews. The former is an extremely smart person and the latter is a person who can get the job done through perseverance and both of these are the hallmarks of a good employee.
- Clear Signals—Knowledge based interviews are notorious for giving ambiguous signals. It is very hard to judge a candidate based on his knowledge of an obscure feature of some technology. But in coding interviews, in 1 hour you get a clear signal regarding the candidate. Based on the performance in the coding round, you can easily make a hire/no-hire call.
- Indicator of skills — Most of the companies which conduct these interviews need people who can work on any tech stack and cutting-edge problems. So they need an objective way to determine the skills of a candidate irrespective of the stellar resume(most people who apply to such companies have a stellar resume). Coding interviews test the problem-solving skills of a candidate which arguably indicates his ability to tackle new problems.
- Experience independent — Coding interviews suits people of all experience levels. Anyone who wants to join such companies is expected to have a working knowledge of data structures and algorithms and thus it can be used as an objective measure to judge the candidates across levels.
Let’s see how to go about preparing for these interviews.
Pick a language
The language you choose does not matter! As long as you are comfortable with coding in the chosen language and it has support for data structures and algos(STL, Collections) you are good to go.
Gotcha — The biggest mistake I see people make here is picking a fancy language to impress the interviewer and struggle with implementation. It is like digging your own grave. The only thing that matters is how you can implement a solution using the language of your choice and not the fanciness of the language.
Exploit the language you picked
You need to be extremely comfortable using the inbuilt DS and Algos in the language you picked. It can be STL or Collections or anything else. Command over these allows you to focus on solving the problem by picking and using the right constructs and churn out code fast in an interview setting.
Timeline: 1 week.
Get familiar with theory
There are only a handful of things you need to know for coding interviews.
- DS — Array, Stack, Queue, Linked List, Tree, Hash, Graph
- Algos — Searching, sorting, BFS, DFS, Topological sort
The things you need to understand are the different implementations, time and space complexities and when to/not-to use them. I would highly recommend The algorithm design manual for this purpose.
Timeline : 2-3 weeks based on previous knowledge.
Gotcha — Do not skip time and space complexities. This is one of the biggest expectations in a coding interview. You are expected to analyse and consider tradeoffs between different implementations and to do that you need to understand the time/space complexities for all the things.
Now that you have a solid foundation of DS and algos you can jump into solving problems. You can use Leetcode and InterviewBit for this purpose. They both allow you to solve problems grouped by type and have a wide array of problems. Do not concentrate on quantity but quality. Try to solve the problem on your own and if you notice patterns among different problems note in down and use these notes to refer again later. If you prefer a book for problems you can use Cracking the coding interview or Data Structures and Algorithms Made Easy.
Timeline : 8–12 weeks.
Gotcha — The worst thing you can do here is trying to learn the problems by reading from somewhere else once you hit a roadblock. However tempting it may be, please avoid it. Do it only after trying for more than 2 hours. It gives you the satisfaction of learning something but, in reality, you cannot solve it when you encounter it somewhere.
If you had followed the above steps correctly, you would be familiar with major types of problems and would be able to solve most problems you encounter in the interview. But whatever you have done till now and the interview setting is totally different. So to get familiar with the interview setting try practicing mock interviews. You can use Pramp for free mock interviews with peers. If you want to have a mock interview by professional and detailed feedback please get in touch.
This is basically a step by step recipe to crack the interviews. I followed the same path and most of the people I know also have done the same. Its just hard work and has nothing to do with previous knowledge or smartness.
I am planning to write a series of posts discussing various topics like Stack, Queue, Trees, etc. one by one and dissecting the various types of problems in each of those. Please follow me to get notified as soon as they are published.
If you liked this story, feel free to reach out to me at https://kaizencoder.com/contact.