Free — no signup required

Introduction: Pattern Recognition > Memorization

2 min read

Don't Memorize Solutions

Think of learning to cook. A beginner memorizes recipes word-for-word. An experienced chef recognizes techniques — sautéing, braising, emulsifying — and applies them to any ingredient. Algorithmic interviews reward the chef, not the recipe-memorizer.

Most interview problems are variations of about 15 core patterns. If you recognize the pattern, the solution structure becomes obvious and the code almost writes itself. Trying to memorize hundreds of individual LeetCode solutions is both impossible and counterproductive — you will always encounter a problem you haven't seen before.

The "Is it...?" Checklist

When you see a new problem, run through this mental checklist before writing a single line of code:

  1. Array/String with a contiguous subrange? → Sliding Window
  2. Sorted array, pair-finding, or symmetry check? → Two Pointers
  3. Locally optimal choices lead to global optimum? → Greedy
  4. All permutations, subsets, or constraint-satisfaction? → Backtracking
  5. Tasks with dependencies or ordering constraints? → Topological Sort
  6. Overlapping subproblems where you need the global optimum? → Dynamic Programming

The five patterns covered in this lesson — Sliding Window, Two Pointers, Greedy, Backtracking, and Topological Sort — collectively solve the majority of array, string, and graph problems you will encounter in technical interviews.

How to Use This Lesson

For each pattern, the goal is to internalize three things: what kind of problem triggers it, how the mechanism works, and what the code skeleton looks like. Once those three are locked in, you can adapt to any variation.

This is one of 18 chapters

Every chapter is free — Kubernetes, Terraform, SRE, distributed systems, and more — with fast daily review built in.

Sign up free