Tips for “whiteboard” and “paper” coding interviews

In my career as a software developer, I have interviewed over 100 people. Most of these interviews were face to face interview involving coding on paper or a white-board. In this article, I want to give you practical advice on how to approach these interviews.

“Whiteboard”, or “paper” based coding technical interviews, are the interviews in which you are asked to write code, either on a whiteboard or a piece of paper in front of you.

There is an idea that these interviews are difficult, or that they are very different than coding with an IDE. In reality, this is because most people, somehow strangely, never practice for them!

The good news is- you can practice and prepare for them, which will make these kinds of interviews your strength. If you do, you will stand out from other candidates and will be more likely to get that job that you want.

Practice coding interview questions on a computer

First of all- don’t assume that you can cheat these interviews by some tricks. The best thing you can do is spend some hours actually practising interview style questions on a computer.

I have written an article about keeping you coding skills sharp with HackerRank. I consider it a great approach and something that you should definitely do before attending a whiteboard or paper-based interview.

If you feel that you may need to prepare even more, or you are interviewing for a company famous for very difficult whiteboard interviews, I strongly recommend you to have a look at “Cracking the Coding Interview” which I reviewed some time ago.

Practice coding interview question on paper or a whiteboard

Assuming that you can program and you know the theory enough to pass the interview if it was with an IDE, why is whiteboard coding still a problem for people? It is because most people do it only during the interview!

The solution to this problem is really simple… Try solving a few problems on a whiteboard if you have access to one. If you don’t just try solving them on paper, without an IDE. Really, it is that simple.

I guarantee you that once you do it a few times, all these interviews will become much less intimidating.

How to effectively code on paper or whiteboard

Even if you practice a bit, it is useful to know some practical tips related to coding on paper:

  • Choose short variable names – seriously, it will save you a lot of time and effort
  • Don’t immediately close that { bracket – many candidates write } bracket somewhere halfway down the page, then they stress about the space left.
  • Have the basic algorithm worked out before you start coding – when working with IDE people often use the code to come up with a solution. It does not work so well on paper. Know what you want to write before you start writing
  • Be smart about the available space – make sure to start from the top of the page/board and choose the size of your writing wisely. Best if you can fit on the page and this is easier when you maximise the space available
  • Talk through your thinking as you write – this way it will be easier for the interviewers to follow your progress. As a bonus, you may get some directions and a collaborative feel to the whole exercise
  • Don’t get hung up on details – if you can’t remember a method name on a standard library, just choose something similar. If you get called on that, be honest- most interviewers won’t mind you forgetting a method name.
  • “Debug” your code with some examples – it is easy to make an obvious mistake on paper – forgetting to return a variable or something like that. If you run through your code with an example inputs (out loud), you can catch these mistakes.
  • Leave some space between the lines – it will make much simpler to add code there if you need to.

How to solve a paper or whiteboard question

The tips above are very much related to actually writing code on paper or a whiteboard. I want to repeat some popular advice about solving these questions, that is all too easy to forget.

  • Triple check that you understand the question – one of the worst scenarios is to misunderstand the question and attempt solving something else, as the puzzled interviewers watch you.
  • Know the primitive types and basic data structures – you should know your int, String, HashMap etc. pretty well before the interview. Make sure that you know the APIs.
  • Understand the big O notation – it is really not that difficult. Here is a simple article by Rob Bell that explains the basics. The fastest general sort is O(n log(n)).
  • Don’t panic – believe it or not, most of the time, your interviewers want you to succeed. Ask them questions, try not to panic.
  • Practice before – as I mentioned already, practice these kinds of questions beforehand. The more you know the easier it is.

Summary

Paper-based or whiteboard coding does not have to be stressful. If you come prepared, you may even find it entertaining! There are no shortcuts to success, but without the right preparation, you may still try hard and fail. Don’t let that happen to you.

To finish on a light note – “The Fizz Buzz from Outer Space” by DailyWTF is still the funniest story about a paper-based interview that I ever heard!

Good luck in yoru next interview!