-
Notifications
You must be signed in to change notification settings - Fork 323
Tips for Coding on a Whiteboard
Coding is hard. Coding on a whiteboard doubly so. Don't be discouraged! Like any skill, whiteboard coding can be improved with practice. Here are some tips to help you improve:
DON'T just blindly start writing down code when you don't have a plan. Before you even uncap the pen, you should spend at least 5 minutes asking your interviewer questions and clarifications. By asking the right questions, you can usually gain insight into how to approach the problem. Make absolutely sure you understand the problem before coding. Steps 1 & 2 of UPER are absolutely crucial.
Always be speaking your thoughts out loud. This is a really unnatural act since coding is usually a solitary, silent endeavor, but it's something you'll need to be comfortable with in interviews. Even more important than getting the right answer is sharing your thought process with the interviewer. An advantage to sharing your thoughts out loud is if you are misunderstanding something but on the right track, the interviewer will often nudge you in the right direction.
I repeat, ALWAYS speak your thoughts out loud. Ideally, the room should never be silent.
This tip ties in with tip 1. Drawing/diagraming things out is a good way to highlight what parts of the problem you don't understand and need more clarification on.
Yes, erasing is a huge pain on whiteboards. Abbreviate your variable names. (This is bad practice in real coding.) Leave extra space if you think you might be adding a line later and use arrows to insert lines where there is no space. Most importantly, think through (and share) your plans BEFORE you start coding.
You're probably used to coding with Google and your interpreter/compiler handy. If you've been keeping your green squares up, you should have a pretty good grasp of your primary language's syntax but in case you forget something (for example, I always get null
mixed up in every language) just ask. I've never had an interviewer penalize me for asking pure syntax questions.
Nothing I've written so far has anything to do with actual knowledge or coding skills so don't let a bad experience make you doubt your technical competence. Practice thinking through problems before coding, sharing your thoughts out loud and writing on an actual whiteboard (use a small-ish page if you don't have access to a whiteboard) without Google. Once you get comfortable with the mechanics, you'll be able to dedicate a full 100% of your brainpower to problem solving and may discover the problems aren't even as tough as you once thought.