paint-brush
5 to 23 Patterns to Ace Any Coding Interviewby@johnvandivier
19,825 reads
19,825 reads

5 to 23 Patterns to Ace Any Coding Interview

by John VandivierFebruary 17th, 2022
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

This article expands on a well-known interview prep document, [14 Patterns to Ace Any Coding Interviews (“14 Patterns”), by providing a more limited starting point, a more inclusive destination, and updated guidance along the way. Leetcode-style DS&A interviews and System Design Interviews make up much of the broader category called [Whiteboard Interviews] These interviews typically have a few common elements: An interviewer asks a candidate to write a program to solve a technical problem that is reminiscent of some problem on [Leetcode]

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - 5 to 23 Patterns to Ace Any Coding Interview
John Vandivier HackerNoon profile picture

This article expands on a well-known interview prep document, 14 Patterns to Ace Any Coding Interview (“14 Patterns”), by providing a more limited starting point, a more inclusive destination, and updated guidance along the way.


14 Patterns is useful as a prep tool for Leetcode-style data structures and algorithm (“DS&A”) interviews. Leetcode-style DS&A interviews and System Design Interviews make up much of the broader category called Whiteboard Interviews, a style of technical interview that traditionally involves a physical whiteboard in the context of an in-person interview. This style of interview is standard for a Big Tech (aka Big N or Tier 1) interview cycle. While much of the interview process is conducted remotely these days, the term has stuck.


Interview Patterns


These interviews typically have a few common elements:


  1. An interviewer asks a candidate to write a program to solve a technical problem that is reminiscent of some problem on Leetcode, or in many cases directly taken from that source.
  2. These 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 be able to give an asymptotic time and space complexity analysis for their algorithmic solution.
  4. There are also many other common features. I would refer you to a resource like interviewing.io for more details.


Whiteboard interviews have had some pushback. The Hiring Without Whiteboards GitHub repository is an excellent source regarding companies that don’t incorporate whiteboard interviews and information on the approaches they use instead.


14 Patterns can be overwhelming to the newcomer. This is a particularly high barrier of entry to a non-traditional or self-taught programmer. Is there any way that we could cut down the number of things to learn, or at least prioritize among these patterns? Yes! Leetcode provides the frequency at which their questions have been seen in actual interviews. Let’s prioritize those patterns that are most frequently used as the highest value and most important to learn first.



Let’s also make sure that our strategy is informed by multiple resources, not just the 14 Patterns. GeeksforGeeks provides a similar DS&A prep resource called Top 10 Algorithms in Interview Questions. The GeeksforGeeks advice overlaps with the 14 Patterns, so we essentially have 10 algorithms recommended by both sources and 4 patterns recommended only within the 14 Patterns. It is noteworthy that the GeeksforGeeks article was provided to me by Uber for official interview preparation.


GeeksforGeeks goes on to group their 10 algorithms into 8 topics. We can use Leetcode frequency data to eliminate the least common two topics. In addition, I eliminate the dynamic programming topic based on consultation with Big Tech career coaches at interviewing.io and reinforced by discussions on Blind. Dynamic programming questions are going through a soft deprecation in Big Tech because they are known to be time-consuming and provide a poor signal of candidate quality during the interview.


Specifically, we eliminate these three low-value topics:


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


To arrive at the Top 5 Patterns:


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


As someone preparing for DS&A, I would begin with these five. Search Leetcode for three easy questions 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 7 high-value topics. These topics are actually not different from the Top 5 Patterns, they are just grouped in a slightly different way:


  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 topic before I worry about moving on to learn new patterns. Then, I would move on to the 14 Patterns. Once I have learned all fourteen patterns to the medium level, I can turn to another great resource to expand my pattern set to 22.


The excellent resource I am speaking about is the Leetcode Patterns Tool from Sean Prashad. This tool sources eight additional patterns by analyzing the Blind 75 and Grokking the Coding Interview, two other well-regarded DS&A interview prep resources.


Final Thoughts


Finally, while interviewing at Uber, I noticed a noteworthy pattern that had been left out of Prashad’s 22, which is the Divide and Conquer technique. This brings my final recommended total to 23. I repeat the learning steps below with recommended timelines for learning each:


  1. Learn the Top 5 Patterns in 1-2 weeks.

  2. Learn the 7 Key Patterns from Blind 75 in another 1-2 weeks.

  3. Learn the above skills to the medium level in another 1-2 weeks.

    1. Note that the Top 5 and Top 7 overlap substantially, so it’s fine to complete as few as 5 problems in this step.
  4. Expand known patterns to the 14 Patterns in another 2-4 weeks.

  5. Expand known patterns to the 23 Patterns in another 4-6 weeks.

    1. Again, you will notice that many of these patterns overlap with one another. For example, recursion is a broad pattern category that lumps together backtracking, divide and conquer, DFS, and other strategies. As a result, you may be able to practice all of the 23 patterns with perhaps a dozen questions or so.
  6. Only at this point would I consider practicing hard questions.


Let’s consider the Top 5 and Top 7 Patterns 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 to learn:


  1. An interesting technique here is to 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 1-3 easy questions, 1 medium, or 1 hard each day, but make sure to take sufficient rest days! Please do not go weeks on end without break, it will likely be counterproductive.


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. Mastering the 23 patterns at the hard level frankly doesn’t seem necessary even for me at the Senior/Principal level, and it’s a thing that can take years to achieve.


Let’s exclude the 3 low-value topics from the 14 Patterns and call the remainder the 11 Patterns. 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/Junior Level: Feel confident solving an easy from the Top 7 Patterns in 20 minutes.

  2. SWE II to III:

    1. Honestly, I have seen so much variation in the difficulty of these interviews that I’m just lumping them into the same level of prep.
    2. Feel comfortable solving any easy and feel moderately comfortable solving a medium from the Top 11 Patterns.
    3. Feel somewhat comfortable (better than 25% chance of success) solving a hard from the Top 11 Patterns in 40 minutes.
    4. Consider training with a service like interviewing.io or practicing until getting a green light from another current Big Tech engineer.