LeetCode pattern drill: name the pattern

This drill trains one step: you read a problem and you name the pattern, with no code. Most people freeze at this step in an interview. Five minutes each day is enough.

The drill uses the 150 problems of NeetCode 150 in Go. It shows a short statement of one problem. You choose one of the 18 pattern families. Then it shows the pattern, the template to memorize and the signal that points to that template.

How to use it

  1. Choose the stages that you studied. At the start, that is stage 1 only.
  2. Keep the titles hidden. A title such as “Binary Search” gives the answer.
  3. Say your answer aloud, with the reason, before you click. For example: “Sliding window, because it asks for the longest contiguous part.”
  4. After each answer, read the signal. The signal is the part of the statement that points to the template.
  5. At the end, repeat the misses. The drill keeps the misses of your last session in this browser.

Seven correct answers out of ten is a good result for a stage that is new. Nine out of ten means that the signals of that stage are automatic. Then add the next stage.

What the answers mean

The 18 families are the 18 stages of the path. A stage is the place where the path teaches the problem.

Some problems fit two families. For example, a problem in the Greedy stage can also have a dynamic programming solution. The drill accepts these answers and marks them in amber as “also valid”. The green answer is the stage that has the solution on this path.

A wrong answer is useful. It shows a signal that you do not read yet. Open the template from the answer and read its signal again.