How to Ace Your Whiteboard Interview: The 5 Patterns to Know

How to Ace Your Whiteboard Interview: The 5 Patterns to Know

Whiteboard interviews have become standard practice for software engineers. Tech companies, including Airbnb, Amazon, Google, Netflix, Twitter and more, all have their version in their interview cycles, which makes this skill an important one to master.

Here is a guide to ace your next coding interview, as told by John Vandivier, a senior software engineer at Amazon.

The whiteboard interview patterns

Data structures, algorithms and system design interviews make up much of the broader category of whiteboard interviews, a style of a technical interview that traditionally involves a physical whiteboard in the context of an in-person interview.

These interviews typically have a few common elements:

  1. An interviewer asks a candidate to write a program to solve a technical problem reminiscent of some problem on Leetcode or, in many cases, directly taken from Leetcode.
  2. The problems are typically solved using abstract data types, in contrast to other technical problems which might be solved using domain knowledge, language-specific techniques, libraries or industry services. The latter is more common in day-to-day programming operations.
  3. Candidates are expected to give an asymptotic time and space complexity analysis for their algorithmic solution.

The top 5 patterns to ace your whiteboard interview

Leetcode provides the frequency at which their questions have been seen in actual interviews. Let’s prioritize the most frequently used patterns as the highest value and most important to learn first.

Specifically, we eliminate these three low-value topics:

  1. Number Theory
  2. Bit Manipulation
  3. Dynamic Programming

The top five patterns on Leetcode are:

  1. Graphs
  2. Linked Lists
  3. Sorting and Searching Algorithms
  4. Tree Algorithms
  5. String and Array Manipulation

As someone preparing for a data structures and algorithms interview, I would begin with these five. Search Leetcode for three easy problems under each topic. Complete one topic per day.

Next, use the “Blind 75” to reinforce these same topics. After eliminating low-value topics from the “Blind 75,” we are left with seven high-value topics:

  1. Array
  2. Graph
  3. Interval
  4. Linked List
  5. Matrix
  6. String
  7. Tree

Again, complete three easy questions from each topic and complete one topic per day. Once I have completed these steps, I would complete a medium from each subject before I worry about learning new patterns. Then, I would move on to the 14 Patterns from HackerNoon. Once I have learned all 14 patterns to the medium level, I can expand my pattern set.

How to approach a whiteboard interview

Finally, while interviewing at Uber, I noticed a noteworthy pattern: the Divide and Conquer technique. I repeat the learning steps below with recommended timelines for learning each:

  1. Learn the top five Leetcode patterns in one to two weeks.
  2. Learn the seven key patterns from the “Blind 75” in another one to two weeks.
  3. Learn each of the skills to the medium level in another one to two weeks. (Note that the top five Leetcode patterns and the top seven “Blind 75” patterns overlap substantially, so it’s fine to complete as few as five problems in this step.)
  4. Expand your known patterns to the “14 Patterns” in two to four weeks.
  5. Expand your known patterns with the Leetcode Patterns Tool from Sean Prashad and the Divide and Conquer technique in another four to six weeks. (Again, you will notice that many of these patterns overlap with one another. As a result, you may be able to practice all 23 patterns with a dozen questions or so.)
  6. Only at this point would I consider practicing hard questions.

Let’s consider the top five Leetcode patterns and the seven key patterns from the “Blind 75” to be basic patterns. Once you are comfortable at the medium level with these questions, it might be useful to try these two studying techniques as you continue:

  1. Try looking at a question and identifying the optimal strategies to solve it without bothering to actually write out the implementation. This technique may allow you to look through a few medium or hard questions in the time it would otherwise take you to fully solve a few easy questions.
  2. Experiment with what works for you! Personally, I follow a “20-minute rule” where I look up the solution if I am unsatisfied with my progress after 20 minutes of work on a problem.

In general, try to complete one to three easy questions, one medium or one hard Leetcode problem each day; but make sure to take sufficient rest days! Do not go weeks on end without a break; it will likely be counter-productive.

How long should you study before interviewing?

I think interviews themselves are excellent practice, and I hesitate to require too much studying in a blocking way before beginning interviews.

Frankly, mastering the patterns at the hard Leetcode problem doesn’t seem necessary even for me at the senior or principal software engineer level, and it can take years to achieve.

Whatever problem you are given, let’s target solving the problem in 20 minutes. With that context in mind, here are some of my recommendations by job level:

  1. Entry-level or junior software engineer: Feel confident solving an easy Leetcode problem from the seven key “Blind 75” patterns in 20 minutes.
  2. Software engineer II or III: Feel comfortable solving any easy and moderately comfortable solving a medium from the top five Leetcode patterns and the seven key patterns from the “Blind 75.” Get somewhat comfortable solving a hard Leetcode problem from these two sets of patterns in 40 minutes.

This article was lightly edited and republished from HackerNoon with permission.