4Approaches to Programming Problems

Coding questions are the heart of the process that most computer and software companies use to decide who to hire. How a candidate performs during the programming interviews is the main determinant of whether an offer is made.

The programming questions are generally difficult. If everyone (or even most people) answered a particular question quickly, companies would stop asking it because it wouldn’t tell them anything about the applicants. Many of the questions are designed to take up to an hour to solve, so don’t get frustrated if you don’t see the answer right away. It’s not unusual for each interviewer to explore just a single question.


The point of coding questions is to try to determine 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 largely determine whether you’re recommended for the job.

The Scenario

You usually work one-on-one with your interviewer. The interviewer may provide you a computer, but often will give you only a marker and a whiteboard (or pen and paper) and ask you to write some code. The interviewer usually wants you to talk through the question before you start coding. Generally, you are asked to write a function or method, but sometimes you need to write a class definition ...

Get Programming Interviews Exposed, 4th Edition now with O’Reilly online learning.

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