DEV Community

Vikram Aditya
Vikram Aditya

Posted on

How to crack coding interviews

First things first, it is very important to spend some time (at least a weekend) on research — finding the right kind of resources to study for your interviews, and coming up with a plan for the next few weeks. This plan might also include the list of companies you wish to apply for, and in what order (yes, order matters!).

The Interview process

The interview process at most software companies broadly comprises the following steps:

Resume screening — Phone interview — (Virtual) Onsite interviews — Hiring Decision— Offer delivery

Before the interviews

The key to preparation for coding interviews is coding practice, a lot of it. But before jumping into that, it is always good to brush up theory concepts which are specifically important for interviews, and have a look at topic wise solved/unsolved problems. This approach is quite similar to how we used to prepare for our school/college examinations. I found the following two books very useful for my preparation. The good thing about these books is that they also discuss problem solving patterns.

Coding practice

There are several websites that offer practice problems for interview preparation. I prefer LeetCode as it has an amazing public collection of Top Interview Questions for all three difficulty levels- Easy, Medium, Hard. My suggestion is to start your coding practice with this curated list (start with Easy or Medium depending on your past coding practice/current comfort level), and then move to other relevant problems depending on your weak topics. Most importantly, practice writing code (with minimum possible errors) on paper or plain text editors/Google docs.

Some free advice

  1. Write things down to learn better, be it maintaining excel sheets of solved problems, docs, or even hand-written notes.

  2. Know the programming language you are going to use during interviews (e.g., C++/Java) inside out, well, at least the library functions.

  3. Learn basic Object-Oriented Programming Concepts, to be able to write modular and clean code with short comments if time permits (Interviewers love modular code!).

  4. Behavioral rounds matter! It does not take a lot of time to prepare for behavioral questions, but they might have a great impact on your application. Use the STAR method to think of answers to common behavioral questions.

During the interviews

  1. Make sure you understand the problem — the problems are deliberately made ambiguous/open-ended. Ask the right kind of clarifying questions and state any assumptions that you make about the problem scope.

  2. Select a simple yet good example/test case, which may lead to insights about how to solve the general problem.

3.Focus on the algorithm and data structures you will use to solve the problem. Think of a couple of approaches, and keep talking to the interviewer (really important) about your thought process.

  1. Explain your best solution to the interviewer — he/she might ask for a more efficient solution. It is very important to resist the temptation to begin coding before figuring out a complete solution.

  2. Code your solution while still explaining to the interviewer, what you are doing. Make sure you write clean and simple code with good variable naming, possibly with proper input validation.

  3. Verify that your code works by tracing it through the test case (from step 2), to remove minor bugs. Next, check your code for all corner and special cases (if time doesn’t permit, at least tell the interviewer verbally).

  4. Lastly, talk about the time and space complexity of your solutio

Top comments (0)