This article was written in collaboration with interview coaches Inbar G. and Ramprasad A. A former Senior Software Engineer at Microsoft, currently a Senior Engineering Manager for DocuSign, Inbar has conducted 100+ interviews and has coached 15+ people. A former Data Engineer for Facebook, currently a Senior Data Infrastructure Engineer for a biotech company, Ramprasad has conducted 200+ mock interviews and has coached 50+ people.
If you are targeting a technical position in a company like Facebook, Google, or Amazon, you’ll likely be tasked with difficult and ambiguous coding problems. Even creators of highly successful software systems fail interviews at top FAANG companies.
Clearly, coding interviews are tough to crack if you haven’t learned how to answer coding questions. The good news is that we have helped thousands of candidates prepare for tech interviews, through our tech interview guides and 100+ mock interview coaches.
We’ve dug into the source material for our engineering interview guides, and we’ve reached out to our coaches to give you advice about what works and what doesn’t.
In this article we summarize the most important tips we have learned in the process. So let's get started!
Let’s start with some tips to help you prepare.
Tip #1: Start early
This might sound obvious, but coding interviews are challenging, so you should start preparing early. Some of the people we work with start studying up to 6 months before their interview. Starting that much in advance may not be necessary for everyone, but the earlier you start, the higher your chances of getting an offer.
Tip #2: Get to know the company
Research the company you’ve applied to. The types of coding questions that show up in different interview rounds will vary according to which company you’re interviewing with.
Companies center their coding questions around real-life issues they’re facing with their current products. When answering questions, you should try to relate your work and your answer back to the company’s current technical challenges or new initiatives. If you can find out what programming language they most commonly use, practice that and use it during the interview.
To find out more about the challenges a company is facing, what new initiatives they’ve just launched, and other topics that will be useful to you during the interview, you can study the company’s press releases, technical blogs, articles on LinkedIn, and other resources. We’ve also published a series of company guides to help you through the interview process at specific companies.
Take a look if you’re interviewing at one of the companies below:
- Facebook software engineer interview guide
- Facebook engineering manager interview guide
- Facebook technical program manager interview guide
- Google software engineer interview guide
- Google engineering manager interview guide
- Google technical program manager interview guide
- Amazon software development engineer interview guide
- Amazon software development manager interview guide
- Amazon technical program manager interview guide
- Microsoft software engineer interview guide
- Microsoft engineering manager interview guide
- LinkedIn software engineer interview guide
- Airbnb software engineer interview guide
Tip #3: Study the concepts
Of course, to succeed in a coding interview, you’re going to have to know how to work with computer science fundamentals like data structures and algorithms. Spend extra time studying those that you’re less accustomed to using in your daily work, as the questions that come up in the interview won’t necessarily correspond to what you’ve put on your resume.
If you need a refresher on data structures and algorithms, as well as quick reference cheat sheets with their time and space complexity, take a look at our specialized guides below.
Data structure guides:
- Depth-first search
- Breadth-first search
- Binary search
- Dynamic programming
- Greedy algorithm
- Divide and conquer
Tip #4: Practice with an answer framework
Working with a defined framework will help you approach coding questions systematically, rather than getting caught on the wrong details and losing out on important time. You need a method that will consistently show your interviewer that you have the right technical knowledge and can break the problem down into manageable pieces.
Our favorite approach can be boiled down into four main steps:
- Test & optimize
For a full breakdown of this framework, as well as an example answer, take a look at our guide on how to answer coding interview questions.
Tip #5: Practice with coding interview questions
Once you’ve reviewed the right technical concepts and learned an answer framework, apply that knowledge to practice questions.
Avoid simply going down a list and memorizing solutions to common questions, as interviewers will try to use questions that candidates haven’t seen before. They are looking for how you think, not just an answer to a question.
Try to find questions that are the most similar to what you’ll be asked, according to the role and the company. For instance, software engineers are more likely to be asked to complete a concrete task, focusing on the inputs & limitations of a certain problem. Engineering managers will be asked higher level questions, focusing on the big picture and how it fits into the larger company strategy.
Replicate the interview conditions as closely as possible by timing yourself and solving as much as you can before looking at the solution. Use a programming language that you will be able to use in the interview. Keep your answers clear and concise: many interview questions only require about 15-20 lines of code to solve.
To find practice questions, you can search for the relevant topics on LeetCode, or take a look at our list of 73 data structure interview questions and solutions or 71 algorithm interview questions and solutions.
Tip #6: Practice with the tools you’ll use in your interview
Many companies will send you preparation materials to use before certain rounds in the interview process, in which they specify the type of coding environment that you can expect. It could be a shared word document, Coderpad, or another collaborative coding platform. If they don’t expressly mention what they will use, take a look at where the invitation link leads.
If you’re able to find out what platform will be used, practice with it. Some coding environments come with features that offer you hints as you go, or that flag mistakes as you type. As most interviewers will not allow you to use such features (other than the occasional verbal hint from the interviewer) we recommend you turn those off. It is also unlikely that you will be able to run your code during the session.
As some coding platforms will come with quirks that could throw you off if you are not prepared, practicing with that platform in advance will help you avoid any unpleasant surprises.
Tip #7: Practice common behavioral interview questions
Even technical rounds will commonly begin with a few behavioral questions before you jump into the coding problem. Interviewers want to understand a little bit about who you are and how you communicate.
The more concise and clear your answers are to these questions, the more time you save for coding.
So prepare your answers to common icebreaker questions like “tell me about yourself.” Be ready to talk about a couple of projects that you’ve done in the past and rehearse your answer until you’ve got a concise one to two minute reply that focuses on your impact.
For more help with behavioral questions, take a look at our guide to behavioral interview questions. This article targets Facebook more specifically, but the method and example answer within could apply to any company.
Tip #8: Do mock interviews
Many excellent technical candidates are rejected or are offered a leveled-down position because they are unaccustomed to interviewing, thus misrepresenting their skills. Although many interviewers try to replicate on-the-job conditions, the way you code on your own is not how you should code in an interview.
The only way to get better at talking through your answer, explaining your thought process, applying feedback, and dialoguing with your interviewer, is to practice interviewing. A great place to start is to practice with friends or family if you can. You can also find peers to practice with on our free peer-to-peer mock interview platform.
This will help you get into the groove of interviewing, but you may not receive the same targeted feedback that you would from an experienced interviewer.
So if you know someone who has experience running interviews at Facebook, Google, or another big tech company, then that's even better. Otherwise, you can practice coding interviews 1-on-1 with ex-interviewers from leading tech companies using our mock interview coaches.
Make sure that you write down the feedback you receive after each round. Use it to create action items for yourself, to know exactly what you should do to improve. The more mistakes you make and address in mock interviews, the fewer mistakes you’ll make when it counts.
Tip #9: Don’t go in cold
Just before you start your interview, work through a coding question on your own. If you’re interviewing virtually, set up your equipment early, then reserve 30-45 minutes to practice a new question. If you’re interviewing onsite, try to set aside some time before you leave.
Similar to an athlete’s warm up before a big game, this will help you get into the right mindset for the problem, remember your framework, and disperse some pre-interview jitters. If you’re interviewing virtually, make sure that your internet connection is strong and that you have a backup hotspot if necessary.
We hope you find these 9 tips useful as your prepare for your interview. For a 7-step plan that you can use to plot your entire preparation process, as well as links to a selection of the best prep resources, check out our coding interview prep guide.
Now that you know how to approach your preparation, let's focus on a few tips that you should use during your actual coding interview.
Tip #10: Don’t jump straight to coding
If you start writing code immediately after you hear or read the question, this is a huge red flag to your interviewer. For many interviewers, a candidate’s collaboration and communication skills are just as important, if not more important, than a candidate’s technical capabilities.
So jumping into your answer without asking clarifying questions or discussing possible approaches with your interviewer signals that 1) you haven’t thought through the answer, and 2) you won’t collaborate with your interviewer. Both are bad signs for how you will work with the team that you are applying to join.
Even when you are sure of how you will solve a problem, think of a couple questions to ask before you begin. You can ask about edge cases, performance requirements, any assumptions you’ve made, or anything else that will help you start a dialogue.
Tip #11: Use pseudocode to explain your thinking
Interviewers want to understand how you think. When you’re explaining how you’re going to approach a problem, writing pseudocode is an excellent way to outline your plan and show your work to the interviewer.
Of course, by the end of the session you’ll want to have written actual code that implements what you’d planned out in the first few minutes. Pseudocode is a helpful intermediary step, but don’t forget to check in with your interviewer before using it.
Tip #12: Talk through your answer
Interviewers are more interested in understanding how you work and how you think than whether you find the right answer to a problem. They are not only testing your technical knowledge, but also your problem-solving skills and your ability to work in a team.
So treat the interviewer as a collaborator, walking them through the steps you’re taking and clarifying any assumptions you’re making. If you need to concentrate on a tricky part, you can take a minute or two to work in silence, but don’t forget to pause and explain what you’ve done before moving on. Of course, be careful not to use any inappropriate language or swear words.
Tip #13: Ask for hints (but not too many)
Most interviewers aren’t interested in watching a candidate flounder for an hour. If you get stuck, speak out the points making you confused (e.g. “here’s what I’m thinking…”), and allow the interviewer to guide you back to the right track.
As a last resort, you can even ask for a hint outright (e.g. “To be honest, I’m stuck. Could you give me a hint of where to go next?”). This isn’t ideal, but it’s better to ask and be able to move forward than to end an interview session without writing any code.
Of course, try not to do this more than one or two times, or else the interviewer will question your problem-solving skills.
Tip #14: Listen for subtle hints
On the other hand, you won’t always need to ask for hints if you catch the ones that interviewers are already giving you. If your interviewer tries to steer you in a direction, follow them. 99% of interviewers have good intentions, and they're trying to help you.
Pay attention to what they tell you, and don’t allow yourself to get so stressed that you don't pick up on what the interviewer is saying. If you talk through your answer, as we mentioned before, this will give your interviewer more information and more of a chance to steer you in the direction they want you to go.
Tip #15: Don’t bluff
If you’re unfamiliar with something related to the coding question, say it. Do not pretend to know something that you don’t and struggle through it to the end. The interviewer will see through this and dock points.
You can simply state, “I don’t know,” or you could say, “I’m not sure, but I believe that XYZ is the case.” Your interviewer will likely jump in to correct you if you’re wrong.
Alternatively, you can state what you are unfamiliar with and ask to look it up (e.g. “I think a priority queue is the appropriate solution here, but I’m unfamiliar with its library in C++. Could I look it up?”). Some interviewers will allow it, as it would help them understand how you would work to solve problems on the job.
Tip #16: Pace yourself
Timing is important, but it shouldn’t be a cause for panic. When you’re working through practice questions, use a watch or another device to help track the minutes. Make sure it’s the same one that you’ll be able to use during the interview itself, so that you’re comfortable with checking the time and adjusting your answer accordingly.
If you’re interviewing virtually, you can set up a timer next to your screen that will count down from 45 or 60 minutes, according to the length of your interview.
Follow the framework we mentioned in the prep section above: spend the first few minutes clarifying the question, then take about 10 minutes to make a plan with your interviewer. At 20 minutes in, you should be coding or starting to code. After 40 minutes, you should be testing and optimizing. Watch the clock so that you don’t get bogged down in a tangent.
It is ok to stop and clear your head if you get stuck. A 30 or 60 second pause to regroup and gather your thoughts may feel like an eternity, but will not significantly eat into your interview time. It is better to have one minute of silence than ten minutes of spinning your wheels.
Tip #17: Break the problem into smaller tasks
The types of coding questions that are asked in tech interviews can typically be broken down into 2-5 tasks that will each take a few minutes to complete. While you’re making your plan, list out these small steps and explain them to your interviewer.
As you work, cross out each of these steps one by one, and tell your interviewer (e.g. “I have completed task X, and now I will work on Y, then Z.”). This will give you a confidence boost each time you finish a smaller task. It will also give the interviewer a sense of how you will be able to tackle long-term, difficult projects on the job.
Tip #18: Keep moving
To avoid getting bogged down in details, get the general code down first and work out specific details after. Don’t aim to find the most optimal solution immediately.
Try focusing on the simplest form of a problem and solving for that first, while clarifying to your interviewer that it is not optimal. Then complexify the problem and solve for that, continuing to expand and optimize as you go.
For example, if you’re given a two-dimensional matrix problem, you can start by solving for a 1x1 matrix, then reevaluate for a 2x2 matrix, then nxn, then mxn, and so on. This method will help you avoid freezing and ensure that you can always answer at least 70-80% of a given problem.
If you can’t work out exactly how to code a specific function, flag it and tell your interviewer what it will do, then come back to it after you’ve finished the rest of the code. This keeps you from breaking your flow and gives your brain a break. You may end up thinking of a better way of going about it than what you had initially planned.
Tip #19: Proactively acknowledge tradeoffs
Any decision you make will have a tradeoff. So call them out in real time, and use it as an opportunity to discuss different options with your interviewer and explain why your choice is the best one. If you don’t bring up tradeoffs, your interviewer will almost certainly ask about them. So it’s better to beat them to it and show that you’ll consider these factors on the job as well.
Tip #20: Test your code
Do this before the interviewer prompts you to. Practice debugging as you implement (e.g. using intermediary debugger statements, print statements, etc.) to fix problems as you go.
Once you’ve finished coding, test your code in multiple ways to pinpoint any potential problems. Do unit tests, writing out the inputs and outputs of your code, replicating the type of testing that a computer would perform.
You should also thoroughly test edge cases. For example, if your code inputs a number, test what happens if that number is negative, 0, or a decimal.
If you do find bugs in your code, don’t get discouraged. Explain what went wrong to the interviewer, and what you could have done differently. If you have enough time, ask if they’d like you to fix it. Take it as an opportunity to show your interviewer how you learn from your mistakes.
Tip #21: Save questions for your interviewer
Most interview rounds will finish with a few minutes that you can use to ask your interviewer questions. Neglecting to ask them questions will give the interviewer the impression that you’re not invested enough in the company or in the job.
Take some time to consider a good question, rather than something you could have easily researched in advance. You can ask what the interviewer’s experience at the company has been, what you should expect from your position after six months or a year, what is fun about the job or company, what some of their current challenges are, etc.
Got a coding interview coming up?
Coding interviews can be tricky. But if you start preparing in advance, follow a step-by-step approach, and get used to talking through your answer, you stand a much better chance of getting hired at companies like Amazon, Facebook, or Google.
Like we said before, doing mock interviews is a hugely beneficial way of preparing for your interviews. That’s why we created our coaching service, where you can practice coding interviews 1-on-1 with ex-interviewers from leading tech companies. Learn more and start scheduling sessions today.