Whiteboarding Practice
07 Oct 2015Whiteboarding code is a common interview challenge, difficult for even veteran programmers. Everything you know is harder to remember under stressful conditions. But it's a skill we can practice!
Introduction/rules/advice:
You will have 20 minutes to solve a randomly-selected problem as well as you can. If you finish early, your interviewer may tweak the problem or ask related questions. After your 20 minutes, the interviewer and/or listeners will have 5-10 minutes to offer feedback on your presentation. Listeners should identify:
- any bugs in your code (briefly!);
- the strongest aspects of your solution and presentation;
- aspects of your presentation which could use improvement.
You must write actual code, but you don't have to start with it. You may pseudo-code/sketch/doodle as needed. It can be a good strategy to avoid fixating on particular code until you've spend several minutes exploring about the problem more generally and articulated a solution verbally.
Whiteboard space management can be difficult; try to anticipate the space needed for your code, examples, and planning sketches.
You may make any assumptions needed to simplify the problem initially, but explain that you're doing so, and try to relax those assumptions before you're finished.
It's OK to pause to think, but keep the audience with you. Think out loud whenever possible.
Everybody will come away with a sense that this test is "unfair", because you know more than you were able to demonstrate here:
- you know what to do but can't quite explain it;
- you can solve it but not that quickly, or not with people watching you;
- you can solve it quickly if only you had your usual references and examples to refer to;
- you know All the Things except for this question. It's true: everybody is better than this test will show. For everybody, there's a gap between your potential and your performance here, and that gap isn't equal for everyone. The test isn't fair. But it is productive, and each time you experience the discomfort of this exercise it becomes easier.