Home/Blog/Interview Prep/How to ace a coding interview even if you can't solve the problem
Home/Blog/Interview Prep/How to ace a coding interview even if you can't solve the problem

How to ace a coding interview even if you can't solve the problem

8 min read
Nov 14, 2023

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.

General tips to ace a coding interview#

Aside from problem-solving skills, here are some general tips to help you nail your next interview.

Code by hand Sometimes, technical interviews will require you to answer questions by coding on a whiteboard or a piece of paper. If you’re unfamiliar with this format, it’s a good idea to get a feel for writing syntax by hand.

Write pseudocode Pseudocode is a way of representing code through simplified language and more human syntax. Writing problems out in pseudocode is a great way to plan a program. You may be surprised at how much easier problems are to understand when you start approaching them with pseudocode. Additionally, regularly translating instructions meant for a computer into human instructions can be helpful practice for interviews.

Practice communication Effective communication is crucial when it comes to any interview. But being able to solve a problem is only half of the battle when it comes to a coding interview. Your interviewer cares if you get it right, but only if you can effectively explain your thought process. Communication is often a soft skill that can be easy for developers to overlook, but it is prioritized because software developers rarely work solo. Hiring managers need to be sure that their candidates can articulate their ideas and collaborate smoothly.

Show enthusiasm Many hiring managers gravitate toward candidates who demonstrate a genuine passion for coding and software development. You want to give the interviewer the impression that you aren’t going to get bored of the organization and leave after six months. Enthusiasm about the work you’ll be doing is an easy way to score some points in your interview.

Review computer science fundamentals Four words: algorithms and data structures. Almost every coding interview question will involve algorithms and data structures to some extent. Regardless of when your last interview was, it’s an excellent time to review graph traversal, sorting and searching algorithms, as well as how to manipulate arrays, linked lists, and trees.

How to approach problem-solving interview questions#

Being an effective programmer means you also have to be a shrewd problem solver. You won’t know how to solve every problem you’ll encounter in your career immediately; but with enough experience, you’ll have the right tools and strategies to start working on a solution.

It’s important to approach coding interview questions with a calm, clear mind. Struggling through a problem because you are nervous or overwhelmed is an easy way to lose track of time. Remember, you need to showcase your strengths in 30 to 40 minutes, so take a deep breath to compose yourself when needed.

Understand the problem Asking qualifying questions will help you better grasp the problem, and it will tell your interviewer that you know how to break down a task. Depending on the type of problem-solving interview question you’ve been asked, your individual clarifying questions will vary. Sometimes you need to understand the requirements of the proposed program better. At other times, you may need to consider end-users, scalability, or even cost.

Look for patterns Once you feel as though you adequately understand the problem, you can look for patterns that link this problem to others you have experience with. Many coding questions rely on shared concepts. If you detect a pattern, you can start considering the different algorithms and data structures needed to solve the problem.

Weigh your options Be sure to weigh your options aloud, so that your interviewer can understand your thought process. We know that your reasoning is important to the interviewer, but you need to be deliberate about making your reasoning transparent. This may feel unnatural, so it’s a good idea to practice talking through a technical question and weighing your options with a friend.

Practice with coding interview problems#

The most challenging part of a technical interview is determining the ideal algorithm or approach for the job. Practicing with many different coding problems will help you understand the technical skills necessary to write code to meet specific requirements. Still you will need to put in the work to consistently recognize and understand the overarching patterns. Learning and practicing these patterns can equip you with the tools to approach any type of problem-solving interview question confidently.

We offer a Coding Interview Patterns course that covers 27 of the most popular patterns in your choice of language.

Taking a deep breath#

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.

Clarifying 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.

Creating good examples#

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.

Doing it by hand#

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.

Going simple, then optimizing#

It’s much better to have an inefficient solution than no solution at all. A lot of the time, it’s easier to come up with something that simply works. From there, you can discuss steps you could follow to improve it or mention potential bottlenecks and how to fix them.

Taking a hint#

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.

Last-Minute Coding Interview Tips to the Rescue#

Cracking the coding interview is not a piece of cake. But if you don’t have much time and need to do a lot to prepare, then Educative-77 and Educative-99 can help you significantly. Educative-99 is a combination of the most commonly asked coding-interview questions. Curated by experts, the questions cover all the topics that appear in coding interviews.

If there is a time constraint, and you still want to ace your coding interview, there is no better option than Educative-99. And to make learning easier, Educative-99 is available in five different languages:


Wrapping Up#

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.

Happy learning!


Written By:
Erin Schaffer
 
Join 2.5 million developers at
Explore the catalog

Free Resources