Howdy! I’m a Software Engineer at Google, living in Austin, TX. Before Google, I was working for Facebook (Meta). I'll mainly write about tech stuff here. I like video games and french bulldogs.

How to prepare for Coding Interviews

Updated: 2023-01-17


Created: 2023-01-10

5 mins
Cover Image

Table of Contents



I’m going to write a series of posts about interviews, such as coding, system design, behavioral, network, and operating systems. This series focuses on tech giants like Google, Meta(Facebook), and Amazon, but is most likely applicable to other companies.

Today I’ll focus on coding. I’ve passed interviews for all the 3 companies above as well as interviewed many candidates as well, so you can count on me!

How to prep for Coding Interviews

Let's talk about the ideal interview process. You want to;

  1. Read the question.
  2. Ask questions to define the problem.
  3. Create several test cases.
  4. Explain your solution.
  5. Implement the solution.

Single, right? Let me dive into each step now.

Read the question

This sounds easy, but sometimes gets challenging if you are not used to the way that these questions are phrased. On top of this, you want to be able to guess the expected solution instantlly after reading the question, which is probagly the hardest part of the coding interview. You might be able to come up with the solution in the later steps, but it definitely affects the rest of the interview.

Fortunately, there are many websites that helps you for both of the difficulties mentioned above by letting you solve similar questions. Note that you need to solve a lot of problems tho.

I recommend LeetCode. It’s the de facto standard site for coding interview prep and offers tons of coding problems that are asked in actual interviews. Although there are some criticisms towards the site, all the recruiters from big tech giants told me to use it, and all of my colleagues use it too. If you don’t use it, you’d be having a big disadvantage.

I ended up solving 400 problems in total (80 easy, 240 medium, 80 hard). Note that I've been using the same account for years whenever I need to prepare for coding interviews tho. After solving 200~300 problems, you’ll find most of the problems relatable. Make sure that you review the problems that you are not comfortable with. When I review problems, I open them one by one, read the problem description, and make sure that I can come up a solution and implement a executable code for that in my head. Don’t waste your time on implementing something that you’ve already understood well.

Ask questions to define the problem

The interviewers don’t just watch your puzzle-solving and coding skills. Problem-solving and communication skills are just as essential as these skills. You are expected to clarify the problem by asking questions. Some questions are vague on purpose. Don’t make any assumptions, you won’t have enough time to cover it up later. This is actually applicable to real tasks, and they want people who can do that. Also, if you don't have a solution that you think is acceptable by this point, just ask for one or two hints. An acceptable solution with a few hints is way better than an unacceptable solution without hints, as an unacceptable solution is an automatic reject.

Create several test cases

Some people skip this but I recommend that you do this. This sets clear requirements of what you need to implement. This also uncovers your misunderstandings on the problem more often than you think. If you don’t have enough time tho, just skip this or briefly explain the test cases and go ahead.

Explain your solution

Ideally, you wanna compare multiple solutions with a focus on their time/space complexities. Never heard of these? These are used to estimate how much time/memory space an algorithm takes without writing any code. This is very powerful in your daily coding life, especially when you are working on a large dataset, as you don't have to waste your time on coding a solution that does not work. There are a lot of good resources on these online, so I won’t go into the details here. After presenting your solution, you want to confirm if you can go to the implementation with your solution. If the interviewer says yes, the solution is most likely one of the acceptable ones. If not, the interviewer probably tells you that there is a more efficient solution.

Implement the solution

I have 3 things to mention here. First of all, readability matters. Give good names, separate a unit of code into a function/method, and avoid deep nests. Secondly, check the time/space complexities of functions/methods in STL, especially the ones for string and collections. The official document for each language should have this somewhere. Here is an example for Python. Lastly, It is okay not to remember function or method names. Just make pseudo names for them. If you do this too much tho, it might makes the interviewer question your fluency in the language. To avoid this, solve LeetCode problems on LeetCode Editor. Don’t rely on any auto-complete or even syntax highlights. It’s difficult at the beginning, but you’ll get used to it after solving 10 to 20 problems.

How far are you?

This is actually quite difficult to know, as questions are different every time. There are several ways that you can still get a good sense of how far you are tho.

Watch mock interviews on YouTube

I recommend Clément Mihailescu. He is an ex-Googler and ex-Facebook like I am, and I generally agree with what he says (well, except for the programming language ranking video). He uploads tons of mock interview videos and the interviewees vary from competitive programmers to college students. It will definitely help you have a better idea of how far you are.

Do mock interviews by yourself

Just pick random problems from LeetCode. Time the interview. You can use problems that you are familiar with just to get used to the interview time schedule. It’s like a typical presentation practice. If you don’t know how to use the interview time, you are not ready.

Take mock interviews with a real person

If you have an software engineer friend, ideally working for one of the tech giants, ask him/her to do a mock interview with you. If you don’t, there are services where you can do mock interviews with people online. I’ve never used them so I cannot give you a recommendation here, but Googling “mock coding interview” will give you many options.

How to deal with mental stress

There are a lot of stress you need to deal with when preparing for an interview. I've done it several times, and I'll give you a little advice on this.

Preparing for interviews sucks

This is true for most of the people. I hated it every time I did it. Unfortunately tho, coding interivews have become the most popular and stardard way for tech companies to measure your skills. The luckly news is, I do feel that this is a trainiable skill for most of the people. You just have to practice a lot it if you wanna get into a company which requires you to take coding interviews.

No interviews can 100% accurately measure your skills

As you don’t know what questions you’ll get, there is definitely an element of luck. Generally speaking, the more you practice, the less you depend on luck. However, sometimes you just get bad luck. Even if you get bad luck tho, remember that this is not the only chance you get. You’ll be able to apply again in the future. This is not the only job opening either. There are a lot of companies out there.


  • Coding Interviews access not only coding skills but also problem-solving and communication skills.
  • Do a lot of LeetCode without any auto-completion and syntax highlights.
  • Watch mock interviews on YouTube.
  • Take mock interviews.
  • Don’t overstress yourself.

See ya next time!



Howdy! I’m a Software Engineer at Google, living in Austin, TX. Before Google, I was working for Facebook (Meta). I'll mainly write about tech stuff here. I like video games and french bulldogs.