Less noise, more data. Get the biggest data report on software developer careers in South Africa.

Dev Report mobile

How to Ace Your Next Coding Interview

18 December 2019 , by Michael White

Coding interviews are a vital part of most tech hiring processes, so it’s important to be as prepared and confident as possible. Of course, this is easier said than done. It’s possible to feel completely sure of yourself throughout the majority of an interview, just to freeze when a tricky question is posed. In this article, I’ll share the lessons I’ve learned from my successes and failures in interviews and give you some tips on how you can succeed in your next coding interview.


I’ve had experience interviewing with both international tech giants as well as smaller local companies, but the process has always been more or less the same: To start with, you will generally face an HR screen where they make sure you satisfy the minimum requirements for the role. If you do, you will move onto technical evaluations, which are typically conducted by engineers and engineering managers. These may consist of interviews that evaluate several different aspects of your technical proficiency, such as coding, design and existing experience.

For entry level roles, there is often more emphasis on coding and I'll be sharing my experience with this in this article.

What are coding interviews about?

In my experience, coding interviews first and foremost seek to ascertain whether a candidate has the problem solving skills and understanding of computer science fundamentals that are necessary for developer jobs. Some might argue that coding interviews don’t test candidates on the actual day-to-day tasks they will encounter as developers. I hold the perhaps controversial opinion that they tend to be fairly good at limiting false positives, which, for many companies, is more important than limiting false negatives.

Whatever your view on the matter, coding interviews are very common in current developer hiring processes, so it’s worth investing the time to learn how to ace them.

There are two types of coding interviews:

  • Phone interviews are typically set up either via a phone or an internet call with your interviewer who will send you an invite to join a collaborative online code editor session.

  • On-site interviews will typically happen in a conference room where you will write your solutions on a whiteboard.

While you will face similar problems in both, I’ve found that on-site interviews typically involve problems that are a bit more challenging.

In either case, remember that you won’t have access to the normal conveniences of your favorite code editor, such as syntax highlighting and autocompletion!

That being said, what do you need to know to ace a coding interview?

Coding interviews generally test four main categories of knowledge:

  • Big O Complexity
  • Data Structures
  • Algorithms
  • Language Proficiency

There isn’t space in this article to give in-depth explanations of the concepts in each of these categories, but I’ll give you some pointers about why these are so important and what I generally focus on when I prepare. For full explanations of each of these concepts, I've listed the resources I've found to be most useful at the end of the article.

Big O Complexity

Data structures and algorithms are super important to understand, but I've learned that it’s impossible to discuss them properly before you understand the concept of Big O complexity.

At its core, Big O is simply a notation to discuss how the performance of a solution scales as the problem size increases. Don’t be fooled though. In my opinion, this is the most important concept to understand in this whole list.

Without a core understanding of Big O complexity, I've found that you won’t know whether the solution you are proposing is optimal, or if another solution you have in mind might be better. Moreover, in some cases, there may be two solutions that are optimal on different metrics and it is important to be able to point out and discuss the trade-off in that case.

If you’re unable to answer an interviewer’s questions about the Big O complexity of a given solution, it’s likely that they will start doubting how much you really know about CS fundamentals, so I've found that it's very important to be solid on this.

Data Structures

Most interviews consist of coding problems that require the use of suitable data structures to end up at an optimal solution.

Some data structures will perform excellently in one task, but terribly in another, so knowing which data structure to use in any given situation is a very important skill.

For each data structure, I've found it useful to know:

  • The efficiency of different operations, such as search, deletion and retrieval
  • Their space efficiency
  • Their general use cases

In my experience, the most commonly used data structures for interview questions are trees and hash tables, since they are covered in detail in most CS degree programs, and give optimal performance for many common tasks. However, it’s important to have a broad knowledge of many others, as interviewers sometimes like to mix it up. That’s why I like to prepare myself for:

  • Hash tables
  • Trees
  • Stacks
  • Queues
  • Priority Queues
  • Heaps
  • Arrays/Lists
  • Graphs
  • Tries (character trees)


Often, arriving at an optimal solution to a problem relies on your knowledge of algorithmic fundamentals, such as the difference between recursion and iteration, or basic knowledge of particular categories of algorithms, such as how efficiently a list can be sorted. Sometimes, interviewers may ask you to provide a solution for a specific part of a common algorithm, disguising it as a normal interview problem. For example, implementing only the merging part of mergesort.

While there aren’t that many specific algorithms you’ll typically need to know, I've learned that you should understand the few required ones in and out, and be able to implement them on the spot if necessary. I’ve found that the following concepts are important to focus on:


  • Quicksort
  • Mergesort


  • Breadth-First Search
  • Depth-First Search
  • Binary Search

Algorithmic Fundamentals

  • Recursion vs. iteration
  • Dynamic programming

Language Proficiency

In my experience, interviewers care more about how well you know data structures and algorithms than your knowledge of specific languages. However, I’ve come across some interviewers who threw in a couple of “trivia” questions about my chosen language at the start of interviews. These are often posed as a sort of icebreaker to get you comfortable talking.

'Trivia' questions about your chosen language also help the interviewer get a sense of whether you’re the type to make the extra effort to push your expertise above and beyond what’s required to get the job done.

I’ve found the kinds of questions that interviewers might ask here are quite varied, but if you’re proficient in the language, there is generally not too much to worry about. Here are some examples of the sort of questions I’ve come across:

  • How does memory allocation work in the language?
  • Does the language use garbage collection, and how is this done?
  • How does this language compare to some of the other languages you have experience with?
  • Why is this your favourite language?
  • What are some things about this language you think could be done better?

Occasionally, a particular feature of the language you’re using may become relevant in developing an optimal answer for a coding question, and it’s definitely advisable to bring this up, even if your interviewer doesn’t mention it.

For example, in one of my interviews, I chose to use Python, which became relevant in a question that could be solved with much greater memory efficiency using the generator feature of Python. In order to present this as part of the solution, I needed to be aware of one of the more intermediate features of Python, which demonstrated to the interviewer that I had gone beyond what might be taught in a typical computer science course.

Practice is everything!

I've found that learning and understanding the required background knowledge is really only half of the work when it comes to preparing for coding interviews.

Practice is crucial because it both solidifies your underlying knowledge and starts to build pattern recognition.

In reality, many interview problems are just variations of each other, with the same underlying problem to solve. For example, there are many possible ways to pose a question that boils down to using a hash table to avoid comparing elements of a list with nested for loops (reducing the complexity from O(n^2) to O(n), if you’re already familiar with the Big O notation discussed earlier). Sometimes interviewers will even try to disguise the underlying problem by posing it as part of a contextual story. Good pattern recognition skills will help you ignore these distractions and quickly identify the core problem, saving time for you to actually work on that problem.

Prepare for the environment you'll be in

When practicing, I've found that it’s important to prepare not only for the coding problems themselves, but also for the environment in which those problems will be posed to you.

  • If you have a phone interview set up, practice answering questions on an online text editor that has no compiler or code running capabilities, and none of the conveniences provided by the code editors you normally use, for example, syntax highlighting or auto completion.
  • On the other hand, if you’re doing an on-site interview, get your hands on a whiteboard and practice writing your solutions out by hand. It’s easy to underestimate how important this aspect of interview preparation is.

In contrast to actually solving the problems and learning all the content, this sort of preparation can seem like a minor detail. However, in my experience, it can make a significant difference to how confident and settled you feel on the day of the interview.

Get used to thinking out loud

In my experience, another important aspect of interviews that you should always prepare for is the pressure of having someone else posing the problem, and you having to talk them through your thinking as you solve it.

Before any interview, I make a point to ask every coder friend I have if they’d mind running through a mock interview with me. If none of them say yes, I've found that bribing them with chocolate or ice cream generally works (😛). It's easy to feel embarrassed doing mock interviews with friends in case you mess up a question, but, as I remind myself, it'll be much harder in front of an interviewer with an awesome job opportunity on the line, so getting the practice in will always be worth it!

Final thoughts

Eventually, it’ll be the night before the interview and (hopefully) you’ll be feeling prepared – you've learned and practiced each algorithm and data structure, solved problems on a whiteboard, and done a few mock interviews with friends. At that point, I've found that it's very important to take a moment to relax. Take a walk, listen to music, or do whatever helps you clear your mind. There’s not much more you can do at this point to be any more prepared, so the important thing is to make sure you get a good night of sleep. In my experience, doing this helps me to be more alert and able to focus when it comes time for the interview the next day.

If you have some time in the morning on interview day, it’s not a bad thing to do a few warm-up questions. However, if you’re going to do this, I've found it's best to make sure you’ve put aside some easier questions for this purpose when preparing. One thing you really want to avoid is psyching yourself out by struggling with a hard and complicated question first thing in the morning.

At the end of the day, you want to maintain a good headspace and be confident when you pick up the phone or walk into the room, ready to ace your interview.

Extra resources

There are tons of resources out there to help you in your quest to get that dream job offer! Here are a few I found particularly useful:

  1. “Cracking the Coding Interview” by Gayle Laakmann McDowell

Get your hands on this book. Right now. Seriously, if there is only one point you take away from this article, it should be to get this book. It’s the definitive guide to coding interview preparation, consisting of in-depth explanations of all the required data structures and algorithms (and Big O) as well as hundreds of great practice questions to ensure you’ll be prepared for the kind of problems your interviewer will pose to you. Gayle has loads of experience actually conducting coding interviews, so she also gives great insight into what your interviewer will be looking for as you tackle the problems.

  1. CS Dojo on YouTube

This YouTube channel has many videos explaining common data structures and doing walk-throughs of example questions. The presenter is great at showing the entire thought process one might go through when solving problems in an interview. Rather than just jumping to an explanation of the optimal solutions, he shows how you can work towards the best solution even if it isn’t immediately apparent to you.

  1. LeetCode

This website has an extensive library of challenging questions that you can tackle with their online code editor, making it easy to check that your answer is optimal. Remember though, this shouldn’t be the only practice you do if you’re going in for an in-person interview, as it won’t adequately prepare you for whiteboard coding :).

  1. HackerRank

HackerRank has collaborated with Gayle Laakmann McDowell to produce articles and videos explaining common algorithms and data structures, and also provides some good practice questions to test your knowledge. Much like CS Dojo, Gayle makes sure to take you through the entire thought process of how to solve a problem, rather than just jumping to the optimal solution.

Michael White is a Computer Science graduate from UCT. He's passionate about machine learning, and his Honours thesis explored how it could be used for more efficient malaria diagnosis in rural communities. He's also interested in the field of VR and recently published a paper on the use of haptic props for enhanced user presence in virtual environments. When he's not researching or writing code, he's either playing games or petting dogs.


Recent posts

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.