At most major tech companies, coding problems are the biggest part of the interview process. Some major tech companies have such difficult coding interviews that software engineers often spend months preparing for them.
The questions in the interviews are designed to be difficult, and they can stump even the most experienced developers. Luckily, there are steps you can take to help yourself get unstuck.
Here, we’ve outlined a process you can follow along with some advice to help you approach even the most difficult problem.
The first thing to do when you think you can’t solve the problem is to take a deep breath. Remember that no interview is perfect and that mistakes are expected. These questions are designed to be extremely challenging – no one will have the perfect answer right away.
Even the most seasoned candidates wouldn’t be expected to answer them quickly. From here, there are steps you can take to tackle the problem.
Before taking it any further, start by clarifying the problem. Sometimes, interviewers will purposely leave out some important details.
Asking questions is a good thing and will show your interviewer that you’re thinking deeply about the problem and seeking to understand it better.
Asking clarifying questions is a skill that you’ll regularly use as a developer, so your interview is a great place to showcase this skill.
Now that you’ve clarified your understanding of the question, it’s time to create some examples. Think of some possible inputs and what the expected outputs would be for them. Think about a few edge cases that may need special consideration.
Remember to explain your process out loud. Your interviewer doesn’t necessarily care if you can solve this specific problem perfectly, they care about gaining insight into your problem-solving methods that will lend themselves to the job you’re applying for.
If a solution doesn’t immediately come to mind, it can be helpful to solve the problem by hand first. Forget that this is a coding interview for a second. If you were asked to solve this problem by hand, how would you approach the problem?
Try to reverse engineer your thought process. Sometimes, nerves can cause us to get caught up in algorithms, but take away the coding, and we can quickly arrive at a solution.
If you’re totally stuck, it’s okay to ask for a hint. It’s better to ask and actually get somewhere than end up with nothing. If possible, ask for a hint on something specific to give you the best chance of getting unstuck. Remember, your interviewer is on your side and wants to see you do well.
It seems coding interviews are only getting harder, causing even the most experienced candidates to become stuck.
Luckily, you now have a process to follow in case you ever get stuck on a coding problem in an interview. The best thing you can do is to study and prepare as much as you can before your interview.
To learn more about how to prepare for your coding interview, check out Educative’s Grokking Coding Interview Patterns series. Our coding interview prep isn’t based on arbitrary brainteasers. You’ll learn to recognize coding patterns and learn how to solve hundreds of different coding interview questions.
Join a community of more than 1.6 million readers. A free, bi-monthly email with a roundup of Educative's top articles and coding tips.