DSA interview patterns
A small number of patterns cover most coding interview questions. The skill that actually matters is recognizing which pattern applies to an unfamiliar prompt — not having memorized a solution to a similar-looking problem.
Why patterns beat memorization
LeetCode has over 3,000 problems. Nobody memorizes 3,000 solutions, and interviewers know it — which is exactly why almost no interview question is genuinely novel. It is a known pattern wearing an unfamiliar story: "find the longest substring without repeating characters" and "find the smallest window containing all target characters" are the same sliding-window skeleton with different exit conditions. The candidates who do well are not the ones who have seen the most problems — they are the ones who can look at a new prompt and correctly answer "what does this resemble."
Each topic below leads with recognition cues — the specific words and structures in a problem statement that point to that pattern — before getting into how the pattern actually works.
The 8 patterns
Recognize it: "Have I seen this value before" or "count occurrences of something"
Two PointersRecognize it: A sorted array or string, looking for a pair or a palindrome property
Sliding WindowRecognize it: A contiguous subarray or substring with a size or sum constraint
Binary SearchRecognize it: A sorted (or monotonic) search space, or "find the boundary where a condition flips"
Stacks & QueuesRecognize it: Matching pairs, nesting, or "process in the order things arrived / most-recent-first"
Trees & TraversalsRecognize it: A hierarchical structure — anything with "node," "parent," or "ancestor" in the prompt
Graphs & BFS/DFSRecognize it: "Connections" between things, shortest path, or "can you get from A to B"
Dynamic ProgrammingRecognize it: A brute-force recursive solution that recomputes the same subproblem repeatedly
Two concepts that decide whether interviewers trust your answer
A correct solution delivered silently, with no complexity statement, scores worse than the same solution narrated clearly with its trade-offs stated out loud. These two pages cover the skills that sit underneath every pattern above.
Frequently asked questions
- Do I need to memorize all 8 patterns before interviewing?
- You need to recognize them, not recite their names. Most candidates who "know" a pattern from a course still freeze when the same pattern appears in an unfamiliar prompt — the recognition cues on each topic page exist specifically to close that gap.
- Which pattern should I learn first?
- Arrays & Hashing and Two Pointers. Together they cover the largest share of early-loop questions and most other patterns build on the intuition of "what am I storing, and what am I looking up."
- Are these patterns the same at every level?
- The patterns are identical from SDE 1 through Staff. What changes by level is emphasis and difficulty ceiling — DSA is most of an SDE 1 interview and a brief sanity check by Staff. See interview prep by level for the specifics at your target level.
Related
Confirm your level, then focus on what actually gets asked
Free account. Career Memory carries your experience across every part of MyCareerAtlas as prep and practice ship.