In the tech industry, you sometimes hear people talking about whiteboarding during interviews. In a whiteboarding session, you do not code on the computer; rather, you write down your thoughts, pseudo code, and examples on the whiteboard. The interviewer can get to know you and how you think through this process, and might even decide that he does not need you to code on the computer at all. In Hack Reactor, we had several chances of practicing whiteboarding, and the following are my thoughts on how to do it right:
- Slow down! Make sure you understand the question before you start doing anything. Double check with your interviewer if you need clarification.
- Illustrate what you are going to do by listing the target function, input, and output. Ask the interviewer for the input type and value, and the output type and value.
- Ask/clarify time constraints (time complexity), and space constraints (space complexity). List those constraints under input/output.
- If you don’t have a clue on how to start, it’s good to start with a simple example. What’s the simplest example you can think of for the function? Draw that on the whiteboard. You can go through your theoretical steps by marking the process in your example.
- Try to find edge cases. What condition will break your previous process? How can you fix that? Add those fixes to your process.
- Try to come up with a more complex example. Test it through process 4 & 5.
- Your interviewer might ask you, “Are you confident with your method?” Try not to say that you are confident. Instead, try to find an even more complex example to test. After testing, you can maybe ask the interviewer if he/she can think of any condition that you missed.
- You might need to refine your process into pseudo code. Remember, it’s pseudo code! Don’t try to write real code! Your pseudo code should be cleaner since you have summarized your illustrated process.
- Keep smiling all the time and don’t be afraid to ask questions if you are stuck at a certain point.