Success in the Coding Interview!

The coding interview, be it over the phone or in person, is usually the easiest interview to fail. Inexperience with interviewing plays a key role in this failure, since the coding interview has a lot of parts, and algorithms are not the only part of the coding interview that matters. Here are some tips and tricks to help candidates succeed in the coding interview.
Listen to the problem
It may seem obvious that listening to the problem is important, but, in addition to simply listening to the interviewer, a candidate should note down all the key elements of the problem, and make sure their understanding is correct. If the candidate does not understand the problem, they should ask for example input and output to get a better understanding. The candidate can make sure the interviewer verifies the candidate’s understanding by repeating the problem back to the interviewer, or writing down the criteria and new examples not provided by the interviewer. Extra points if these examples are edge cases, since this shows a good understanding of what can go wrong. Understanding what can go wrong is something interviewers look for since it show that the candidate is able to adapt to real world situations.
It is important for the candidate to note the intent of the problem from the interviewer’s point of view. If the first question appears simple, it is likely a smoke test, which is a question that should be accomplished in approximately 5 to 10 minutes. In those situations, the candidate should note edge cases, but get to the solution quickly. As important as it is to clarify the question, it doesn’t mean the candidate can use up a lot of time in the clarification. Being concise is important, and gathering too many requirements could prove detrimental as it may come off as ignorant. In general, a candidate should point out problems that they see could occur, but make sure to only implement what is needed to solve the problem.
Clarity is Key
One of the most important things a candidate should do is clarify. A number of candidates tend to make assumptions and jump right into coding, thinking that they know the answer to the problem immediately. Even if the answer seems obvious, walking through a solution and verifying the assumptions being made before coding indicates experience in problem solving, which is an important part of being a software engineer. All assumptions made by a candidate should be noted and clarified with the interviewer to make sure the assumption can be made. Behind most assumptions are design decisions, albeit obvious design decisions at times, and if a candidate clarifies the assumptions it shows that they have a better understanding of the trade-offs in a program, and the ability to design instead of just code. Design is a key software engineering role, and is something many companies interview for. For more information, see The Technical Design Interview – A Guide To Success.
After clarifying what to code, it is important for the candidate to talk through their solution before putting it to code. This accomplishes multiple things:
If the approach is wrong, the interviewers will often hint at better solutions before the coding begins.
It shows the interviewer that the candidate is able to think before they do, which gives the impression that the candidate will make do this if hired.