How to prepare for software engineer interviews at top tech companies
By: Meghanath Nakka
Tags: Interview Questions, Interview Preparation, Software Engineering, Coding Interviews, Software Interview

Generally the Interviews are split into three phases:

A) Recruiter Screening B) Technical Phone Screening C) Onsite

A) Recruiter Screening: This is a casual phone conversation usually with the recruiter to give you some information about the company, team and position. They also ask about your background and requirements to make sure if they match the role. Although this is a casual conversation, recruiters do a high level assessment from things you speak, some even ask few technical questions which they have no idea about. They just cross check with the answers provided by their technical team. Duration will be about 30 mins.

They check if you are genuinely interested about their company and the position. Do your research about some facts and latest news about the company. They also want to know why you are looking for a new job. This is probably the most predictable interview. So, make some notes about these commonly asked questions and put it infront of you during this interview, since this is just be a phone interview the notes will come in handy. I use OneNote for my notes. Do this for every company you interview for.

Here is the sample notes I made for Uber:

B) Technical Phone Screening: This could either be an online coding challenge or a technical phone round or sometimes both. This can contain anywhere between 1 to 4 coding questions. For preparing this interview follow the Onsite Coding round preparation process described below. Duration of this round varies around 45 min — 1.5 hr

C) Onsite (Virtual onsite during COVID times): Once you clear the above two steps you’ll be forwarded to the final onsite rounds. Total duration could vary anywhere between 4–6 hours. These can be classified into 3 categories:

1. Coding round

2. System Design round

3. Behavioral round

Let’s dive deep into each one of these Onsite rounds:

Coding round:

Usually contains more than 1 round and you can expect more difficult questions than technical phone screening round. Duration of this round varies between 45 min — 1 hour.

This is the foundational and deciding factor for any Software engineer interviews. You’ll be given a question and some sample inputs and you need to come up with a logic that generates the desired output. Usually this could be a single method or class. You need to write syntactically correct code and no pseudo code please! Do your best to nail this round.

Tip: Practice writing code with pen and paper or in a word document, this will help you find where you are making mistakes and try not to make those mistakes next time.

Here is one of the popular questions — Two Sum

To solve such questions and clear this round there are a couple of things you need to prepare and practice. They are complexity analysis, data structures, algorithms, interview questions practice. Each one of this topic is explained below.

Complexity analysis(Big O notation):

Complexity analysis is important for any program you write. Many candidates will be able to solve the given problem but fail to give the most optimal solution. The performance of any two approaches can be compared using two attributes — time and space. The best algorithm should take least amount of time and space. This is represented by Big O. For example a linear time complexity is represented as O(n)

Tip: for every problem you practice, try to calculate time and space complexity then and there and write it in a line of comments. This helps you practice the calculation and eventually makes it feel simple.

Resources:

CTCI(6th Edition) — Chapter VI. This should be good enough for interview purposes Deep dive if you are interested — link

Data Structures:

You need to have an idea on basic data structures and how to use them in your favorite programming language. Some of them are list/array, linkedlist, hashmap, stack, queue, tree, graph. It’s always good to know how these are implemented internally in the programming language of your choice.

While learning data structures focus on the best use cases for any data structure over others. For example if you have to maintain a relationship between any two datasets then hash map would be the best choice. Interviewers observe if you are choosing the right tool(data structure) for the given problem.

Also, observe the complexities for each operation in a data structure and try to understand how that’s calculated.

You can learn data structures from any computer science text books.

Resources:

Algorithms:

Sorting algorithms: Sorting data is a fundamental operation, They turn disordered data into data ordered by some criteria. You can think of a sorting by price from low to high is any shopping website. There are many sorting algorithms, it’s good to know how each one of them functions internally. Few important sorting algorithms are quick and merge sorting Searching algorithms: Searching for some data is the most basic feature of any application. It is about retrieve information stored within some data structure. It’s important to know what are some search algorithms out there. The most basic one is Linear search and a really popular one is Binary search. Recursion: Recursion is a way of solving the large problem where the solution depends on solutions to smaller instances of the same problem. This will involve calling the the same method/function from itself. This might sound easy but is very mind twisting concept. You need to practice a lot to get a good grip on this. Knowing the base condition is probably the most important thing to know in recursion since that decides when you need to stop looping, otherwise it could go into an infinite loop. You need to make yourself very comfortable before jumping into dynamic programming. This is a good place to start learning about recursion — byte-by-byte recursion Tree and Graph algorithms: Trees and Graphs are the favorite data structures of the interviewers. You can expect at least one question in the onsite interview. Mostly you’ll be asked a question that involves Breadth First Search(BFS) or Depth First Search(DFS) Dynamic Programming(DP): DP is probably the most difficult concept of all. The best way to start would be this DP book from byte-by-byte. There are two approaches you can use for solving DP problems — Top-down and bottom-up. Some find one approach easier over the other but it’s crucial to excel in any one the approach and it’s good to understand how each one works. I like the way how he solves the problem by starting with a brute force solution using recursion and then introduces memoization to create a top-down solution and finally inverting the logic to create a bottom-up solution, it’s a really nice way to understand the difference between two approaches. Miscellaneous: There are few other popular algorithms that’ll help you find optimal solutions for certain problems — Greedy Algorithm, Floyd’s algorithm to detect cycle in a linked list, shortest path algorithms like Dijsktra’s and A* (A star).

Resources:

Interview questions practice:

It’s very easy to come up with a theoretical solution to any interview question but it’s really difficult to covert that into bug-free code in 20 minute time frame. You need consistent practice to get there.

Tip: Every time you start solving any problem put a timer and keep shrinking the time as you practice more. A decent time frame is 15 minutes for Leetcode easy level, 20 mins for medium level and 25–30 minutes for hard level problems

If you check Leetcode there will be more than 1000 questions which may be overwhelming in the beginning but there will be a common pattern among them. It’s all about patterns! An amazing course that I found super helpful is educative.io — grokking the coding interview. This course is divided by such coding patterns and covers most of the questions. I found that it’s a really efficient way to practice with these patterns instead of randomly grinding Leetcode. Once you understand the internal mechanics of each pattern it’ll take no time to solve higher difficulty level questions of the same pattern.

Tip: Go through each pattern in educative.io and try to solve it there, if all test cases are passed then try to find the same question in leetcode and run your code there, leetcode contains hundreds of testcases and there is a high probability that your code could fail in few edge cases and then you can debug and fix the issue. This will help you write bug-free code.

Always look for better implementations than yours, even though you solved the question completely, make sure yours is the most clean and optimal solution. Interviewers don’t just need the answer, they look for clean code. Don’t initialize unwanted variables, define a separate method where necessary, do input validation in the first step before solving the problem.

Once you have a good feel with your coding practice start giving mock interviews. I failed in multiple interviews not because I don’t know the answer but just because of the interview nervousness. For every one of those interviews I was able to code up a solution after the interview but failed to perform in the interview. I highly recommend giving mock interviews from a few weeks before your interview cycle. This will help you get used to the interview process and better manage your time in the interview. Pramp is a great resource for that.

Resources: