3.1. The Process

The point of the coding questions is to determine if and how well you can code. It's the most important part of the interview, because the code you write and the answers you give to the interviewer will largely determine whether or not he or she recommends you for the job.

3.1.1. The Scenario

You will usually be working one-on-one with your interviewer. He or she will give you a marker and a whiteboard (or pen and paper) and ask you to write some code. The interviewer will probably want you to talk through the question before you start writing. Generally, you will be asked to code a function or method, but sometimes you will need to write a class definition or a sequence of related code modules. In any case, you will be writing code, either in an actual programming language or in some form of pseudo-code.

3.1.2. The Problems

The problems the interviewers ask have very specific requirements. They have to be short enough to be explained and solved reasonably quickly, yet complex enough that not everyone can solve them. Therefore, it's unlikely that you'll be asked any real-world problems. Almost any worthy real-world problem would take too long to explain, let alone solve. That isn't an option in an interview. Instead, many of these problems require tricks or uncommonly used features of a language.

The problems often prohibit you from using the most-common way to do something or from using the ideal data structure. For example, you might be given a problem like ...

Get Programming Interviews Exposed: Secrets to Landing Your Next Job, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.