Skip to main content

Patterns

Coding Interview Patterns.

Every problem is a costume over a smaller idea. I list the 17 ideas in the order I would meet them, each with its problems, easiest first.

  1. 1Arrays & HashingMost first problems hide one question: what have I already seen? A hash map answers it in one lookup.109 problems · 17 easy · 76 medium · 16 hard
  2. 2StringsMost string problems are array problems wearing a coat. I name the pattern underneath, and the text stops being scary.42 problems · 7 easy · 26 medium · 9 hard
  3. 3Two PointersTwo indexes beat a nested loop when the input has order or symmetry. Every move has to rule something out for good.20 problems · 5 easy · 13 medium · 2 hard
  4. 4Sliding WindowA sliding window turns a search over every substring into one pass. I grow the right edge and shrink the left.8 problems · 1 easy · 5 medium · 2 hard
  5. 5StackA stack remembers unfinished business. I push what is waiting and pop when something arrives that settles it.15 problems · 2 easy · 9 medium · 4 hard
  6. 6Binary SearchBinary search halves the space by asking a yes-or-no question. Everything on one side must answer no.16 problems · 3 easy · 9 medium · 4 hard
  7. 7Linked ListsLinked lists are pointer bookkeeping. I draw the nodes and say which pointer changes on each line.12 problems · 4 easy · 6 medium · 2 hard
  8. 8TreesTree problems reward trust. I decide what a call returns for its subtree, then combine at the current node.21 problems · 7 easy · 11 medium · 3 hard
  9. 9BFS & DFSDepth-first dives and backs out. Breadth-first spreads in rings. I pick by asking whether the first arrival must be the shortest.45 problems · 7 easy · 29 medium · 9 hard
  10. 10GraphsGraph problems start with the adjacency list. Once it exists, I ask whether the job is traversal, ordering or grouping.25 problems · 0 easy · 19 medium · 6 hard
  11. 11HeapsA heap hands you the smallest item fast and lets you keep adding. Top-k problems are its home.19 problems · 3 easy · 10 medium · 6 hard
  12. 12BacktrackingBacktracking builds an answer one choice at a time and undoes the choice afterward. Pruning keeps it affordable.14 problems · 0 easy · 10 medium · 4 hard
  13. 13Dynamic ProgrammingDynamic programming is recursion that remembers. I define the state in one sentence, then ask what it depends on.35 problems · 3 easy · 25 medium · 7 hard
  14. 14GreedyGreedy takes the best choice now and never looks back. It works only when I can say why the choice never hurts.15 problems · 2 easy · 13 medium · 0 hard
  15. 15IntervalsInterval problems get easy after one sort. I order by start time, then ask whether each range overlaps the last.6 problems · 1 easy · 4 medium · 1 hard
  16. 16Bit ManipulationBit problems look like magic until you learn four moves. After that they are small and mechanical.11 problems · 6 easy · 5 medium · 0 hard
  17. 17DesignDesign problems ask for a class, not a function. I list the methods and the cost I want from each, then choose structures.25 problems · 2 easy · 12 medium · 11 hard

Prefer a list?

Fin and Coco are characters, not people. strongyes.io is independent. Leo builds it with AI agents.