Approaching coding challenges in an interview: the basics

Completing a coding challenge with an interviewer breathing down your neck can be intimidating, but there are things you can do to prepare yourself.

Adobe Stock / fitzkes
  • A universal problem-solving routine to tackle the challenge

1. THE ESSENTIALS

Keep calm

This is important for any interview, but never more so than when you’re facing a coding challenge. Our natural reaction to any situation in which we are being judged is to become nervous, hesitant and unfocused. There isn’t a one-size-fits-all solution for this problem, as different people will find that different things relax them best, but one routine that generally helps is to articulate your anxieties and then rationalize them.

Adobe Stock / Seventyfour

Communicate

You could be proving Euler’s theorem in your head, but believe me, nothing will make you look as clueless in an interview as just sitting there quietly. The whole point of a live coding challenge is for the interviewers to understand how you think and how you approach a problem, so for heaven’s sake speak up: if you’re going to add a supporting data structure, explain what makes it useful; if you’re opting for an iterative solution over a recursive one, tell them why; when you choose a particular approach to the coding challenge, tell the people in front of you why your option is better than the alternative(s). Even when you’re simply practicing for the interview, you should make it a habit of speaking out loud and explaining what you’re doing to an imaginary interlocutor — it will be a lot harder to do it on the spot otherwise!

Practice the concepts

One question interviewers are likely to be especially interested in, is how you approach something you do not know. They will be looking for problem-solvers, not people who can reproduce material written by someone else in a textbook. Thus, expect their coding challenges to feature one or more elements of unpredictability, even if the field they belong to is one you know quite well.

2. THE PROBLEM-SOLVING ROUTINE

It is important to recognize that a creative process like coding has a fundamentally individualistic element — how you work best will always come down to you. For this reason, long before you get to the interview stage, you should actively be testing out different problem-solving approaches until you find the one that suits you best.

Lay down input and output

The first step should be the most elementary: based on the material you’ve been given, get a clear sense of where you will start from and where you need to go, or more simply, the input and output of your code. I would recommend drawing out the rough path between these two points, or writing down the fundamentals of the transition.

Adobe Stock / Song_about_summer

Look for edge cases

Unforeseen edge cases are probably the most common reason why candidates will fail a coding challenge. You may have come up with a very smart solution to your problem, only for the interviewer to ask what happens when you try and return a particular string, and suddenly your carefully-constructed code must be furnished with a dozen extra statements which take half an hour to put together.

Break down the problem

Right, you’ve figured out where you’re going and you’ve accounted for the bumps in the road — now it’s time to code! The most important thing you have to bear in mind at this stage is that you should follow a step-by-step procedure of solving — and testing — one small issue at a time.

Optimise

This part will arguably be your truest test as a developer. The reason for this, is that there is no procedure you can use on the spot to make sure you have the best and most elegant version of whatever solution you came up with. It really just comes down to competence, and this in turn comes down not to what you do during the interview but to what you did before it.

We want you to stay one step ahead of a world that’s constantly evolving. And that’s why we have crafted cutting-edge courses in Web Development.