Craig Rodrigues!

A Method for Solving Whiteboard Problems

Whiteboard interviews and technical phone screens are just part and parcel of working as a Software Engineer. Besides learning the data structures and algorithsm you need, the only way to get good at interviewing is to practice. Here is a brief set of steps you can keep in mind while interviewing.

Read and Understand the Problem

  • Read it slowly.
  • Read it again/get it repeated to you.
  • Try and think about what assumptions are hiding in this problem.
  • Ask questions about those assumptions (either to yourself or the interviewer). Nothing is worse than solving the wrong problem.
  • Identify the inputs and outputs.
  • Try and indentify any obvious edge cases.

Outline the Approach

  • Do not go slow intentionally. If you have an idea of what the optimal solution is go there first, while briefly explaining how the sub-optimal solution would work. A lot of whiteboard interviews and phone screens expect you to get through more than one problem!
  • If you don't know what an optimal solution might be, go for the simplest and most brute force solution first.
  • Decide on your core data structure or data type.
  • Outline the logic in some sort of pseduo-code.
  • Walk through your pseduo-code a couple of times with medium-sized example sets.
  • Edit it and make it clear and precise.

Implement

  • Fill in the main function body.
  • Stub out any helper functions that are needed, and implement them later.
  • Make sure each function has (ideally) one single purpose.
  • Test as you go. Write an assertion if you can.

Resources for practice toy problems

How to Refresh the Page While Waiting for an Element with Nightwatch

Changing the color of the last letter of a word using only CSS