4-Step Strategy to Frame Your Thought Process in a Whiteboard Coding Interview

January 18, 2020

Whiteboard coding interviews are often part of an imperfect technical interview process. A 45-minute whiteboard coding problem is not representative of real work on the job, especially due to its unrealistic time restraint. However, working through a coding problem can allow a candidate to showcase their problem solving skills by communicating and walking through their thought process with the interviewer.

These are my notes from Virta Health’s Coding Interview Workshop.

Assuming you have 45 minutes, this is a 4-step strategy to frame your thought process in a whiteboard coding interview:

1. Understand the problem (5 minutes)

Read the problem. Clarify with your interviewer if there are any parts you do not understand. Repeat the problem in your own words to double-check your understanding. Validate your assumptions with the interviewer to ensure you are tackling the correct scope of the problem.

2. Problem Solve (10 minutes)

Before writing code, come up with a strategy on how to solve the problem.

These are a few problem solving strategies:

  1. Divide & conquer: Break down the problem into smaller subproblems and solve them in isolation.
  2. Iterate from the naive approach: The first solution you come up with may not be the optimal solution. If you know your first solution will not be optimized for time and space complexity, frame your work by saying, “The naive approach would be…”. If you have time at the end, iterate upon your naive solution.
  3. Data structures and algorithms pattern matching: Run through common data structures and algorithms used for coding interviews to see if any are applicable to your problem. Some examples are sets, dictionaries, and maps.
  4. Write pseudocode: Pseudocode is an informal, high level description of what an algorithm or program does. Your notes will help you stay on track when you start coding and are in the weeds of the problem.

3. Code (20 minutes)

Before you code:

  1. Get to know your coding environment. Know how to run your code.
  2. Clarify if you can use libraries and look up library constructs.

While you code:

  1. Explain out loud what you're doing as you code. When you’re explaining your thought process, your interviewer has an opportunity to help you if they're following what you’re trying to do. Interviewers are trying to help set you up for success!
  2. Informally test your code early on and at every step of the way to prevent a tricky debugging session at the end of your interview.
  3. Stay on track by referring to your notes from step 2 (problem solving) throughout the coding process.

4. Review (5 minutes)

  1. Test: Review your test cases and ensure edge cases are handled properly.
  2. Optimize: Look for ways to optimize your code for both speed and memory.
  3. Clean up: Refactor your code to tidy up and improve your code structure.

Whiteboard code interviewing is a skill that is and can be learned. Keep up the practice!

Huge thanks to Virta Health for hosting this coding interview workshop and sharing this framework!

What’s your whiteboard coding interview strategy? What are your tips?

Originally posted on dev.to.

⬅️ 5 Things I Learned From Coding with Other People: My First Web Development Team Project

Top 10 Tips for Self-taught Software Engineers from 20+ Coffee Chats ➡️