What to put on whiteboard during an interview
As a programmer, you may go through different kinds of programming tests while interviewing for jobs. The most famous and difficult one may be the whiteboard test for lots of people. Usually the interviewer will give the candidate an algorithm problem or case study and ask the candidate to implement the algorithm with his/her favorite programming language. The code to be written is not too much but it requires the candidate to thoroughly consider different edge cases.
So what does the interviewer expect to see on the whiteboard? We first need to understand the features of whiteboard test before answering this question.
The whiteboard test has following features:
- Write by hand, you cannot use a computer. Hence you cannot search for the functions you want to using Google, Stackoverflow etc. You have to rely on your own knowledge, memory and experience;
- The question usually is related to algorithm implementation. Hence the candidate has to have a clear logic and be careful about different edge cases of a problem
- Since the candidate needs to write the code right in front of the interviewer, the candidate may feel compressed and nervous.
- The time given to the candidate usually is not that enough, so the candidate has to come out a solution which may not be the optimized one within a short period of time
- The thinking process of the candidate is directly seen by the interviewer when s/he writes something on the whiteboard and this lets interviewer has a good impression on how the candidate thinks.
Due to above features of whiteboard test, candidates may make mistakes or fail to consider different conditions. Are the candidates expected to write perfect codes on whiteboard? Let's see experience from Istvan Jonyer, he is currently working at Google and has interviewed many engineers at Google.
His approach to ask the whiteboard question and his expects of the candidate are:
- Understand the problem well,
- Develop an algorithm using drawings and examples
- Pay particular attention to edge cases
- After both interviewer and interviewee agree on the algorithm, should a candidate start to actually write code
- If they make a syntax error, it's OK. The most important thing is that how the candidate handles being corrected if the interviewer points the syntax error out. Are they defensive? Insecure? Or confident and collaborative?
- The code reflects the algorithm they developed
If the candidate launches into writing code, as opposed to developing the algorithm using examples, s/he is likely to make mistakes. s/he is skipping an important step -- the algorithm development. Writing code while at the same time thinking through the algorithm in the head is unnecessarily difficult in a high-pressure interview process.
The worst is when a candidate, upon hearing the question, turns to the whiteboard and presents a flawless algorithm, writing it out sequentially. It indicates that the person had heard the question before, and the interviewer learned nothing about their abilities.
If the candidate is not confident in their answer, The candidate may even throw in a "mistake" to see if they're confident enough to disagree with the interviewer. This could also happen by an honest mistake on the part of the interviewer, which should not throw you off track, and you should stand up to your answer if you know you're right (and prove it).
Hope these tips can help you in your future whiteboard test.