Blog›LeetCode Patterns
LeetCode PatternsCoding InterviewFAANG Prep

Top 10 LeetCode Patterns Every Junior Developer Must Know Before Their FAANG Interview

June 1, 20268 min readPairPass Team

Most junior developers preparing for FAANG interviews make the same mistake: they grind through hundreds of individual LeetCode problems without ever stepping back to ask what pattern is this actually testing?

The result is a catalog of memorized solutions that falls apart the moment an interviewer introduces a slight twist. The better approach — the one that separates candidates who pass FAANG loops from those who repeat them — is mastering the 10 core patterns that underpin the vast majority of coding questions you will ever face.

These are not shortcuts. They are the mental frameworks that let you recognize a new problem as a variant of something familiar, choose the right data structure in under 30 seconds, and spend your interview time communicating a clear solution instead of searching for one.

Why Patterns Beat Problem-Grinding

LeetCode has over 2,000 problems. No one solves them all. But virtually every problem on that list — and in real FAANG interviews — is a variation on one of roughly 15 underlying patterns. FAANG interviewers are not testing whether you have seen a specific problem before. They are testing whether you can identify the structure of an unfamiliar problem and apply a known strategy to it.

The 10 patterns below cover the vast majority of medium-difficulty problems you will encounter at Google, Meta, Amazon, Apple, and Netflix. Learn to recognize them cold. Then practice applying each one to at least three problems from memory before your interview.

The 10 Patterns

Sliding Window

01

A sliding window is a contiguous subarray or substring of variable or fixed size that you move across the input. FAANG uses it to test whether you can avoid brute-force O(n²) nested loops on problems involving contiguous ranges — if you reach for a nested loop on an array, there's usually a sliding window lurking.

Practice:Maximum Subarray, Longest Substring Without Repeating Characters, Minimum Window Substring

Two Pointers

02

Two pointers — one starting at each end of a sorted array, or both starting at the same end at different speeds — collapse an enormous variety of search and comparison problems into O(n) solutions. FAANG interviewers love it because it filters candidates who default to nested loops.

Practice:Two Sum II, 3Sum, Container with Most Water, Remove Duplicates from Sorted Array

Fast & Slow Pointers

03

Also called Floyd's cycle-detection algorithm: one pointer moves one step at a time, the other moves two. When a cycle exists they must eventually meet. FAANG uses this pattern for linked list problems and any scenario where you need to find a cycle, the middle node, or a repeated element without extra memory.

Practice:Linked List Cycle, Find the Duplicate Number, Middle of the Linked List, Happy Number

Merge Intervals

04

Sort intervals by start time, then walk through them checking whether each new interval overlaps the last. It sounds simple but cleanly handles overlapping, touching, and nested ranges — a staple of calendar and scheduling problems that come up repeatedly at Google and Meta.

Practice:Merge Intervals, Insert Interval, Non-Overlapping Intervals, Meeting Rooms II

Cyclic Sort

05

When you're given an array containing numbers in the range 1 to n and asked to find missing or duplicate values, cyclic sort lets you do it in O(n) time and O(1) space by placing each number at its correct index. FAANG tests this to see if you know in-place algorithms beyond the standard sort call.

Practice:Find All Numbers Disappeared in an Array, Find the Duplicate Number, First Missing Positive

Tree BFS / DFS

06

Binary trees appear in roughly 30% of FAANG coding rounds. DFS (pre/in/post-order via recursion or a stack) solves path, depth, and serialization problems. BFS (level-by-level via a queue) solves level-order, minimum depth, and closest-node problems. Know both cold — pick wrong and you'll spend interview time recovering.

Practice:Maximum Depth of Binary Tree, Level Order Traversal, Symmetric Tree, Binary Tree Right Side View

Two Heaps

07

Maintaining a max-heap of the lower half and a min-heap of the upper half of a running dataset lets you find the median in O(log n) per insert — a pattern Amazon and Microsoft reach for on streaming-data and scheduling problems. The insight is using two heaps to keep the middle of a dataset cheaply accessible.

Practice:Find Median from Data Stream, Sliding Window Median, IPO (Maximize Capital)

Subsets / Backtracking

08

Backtracking explores all possible states by building a solution incrementally and undoing choices that lead to dead ends. It's the canonical approach for generating combinations, permutations, and subsets. FAANG uses it to test whether you understand recursive state-space search versus brute force.

Practice:Subsets, Permutations, Combination Sum, Word Search, N-Queens

Binary Search

09

Binary search isn't just for sorted arrays — it applies anywhere the search space has a monotonic property (i.e., if an answer x works, every value above or below it also works). FAANG interviewers use modified binary search to probe whether candidates can generalize beyond the textbook version.

Practice:Binary Search, Search in Rotated Sorted Array, Find Minimum in Rotated Sorted Array, Koko Eating Bananas

Top K Elements

10

When a problem asks for the K largest, smallest, or most frequent elements, a heap of size K is almost always the right tool: maintain it in one pass for O(n log K) rather than a full sort at O(n log n). FAANG applies this pattern constantly in data-stream, frequency, and ranking problems.

Practice:Kth Largest Element in an Array, Top K Frequent Elements, K Closest Points to Origin, Task Scheduler

How to Actually Learn These Patterns

Knowing a pattern exists is not the same as being able to apply it under interview pressure. The gap between recognition and execution is closed through one thing: deliberate practice with real-time feedback.

For each pattern above, work through three to five problems. Write out your solution, then immediately ask yourself: which part of the pattern did I use? What was the trigger that told me this was the right approach? That metacognitive step is what builds pattern recognition — not just completing the problem.

Once you can identify and solve a pattern alone, simulate interview conditions: solve a new problem in a shared editor while narrating your thinking out loud. The discomfort is the point. If you only practice in silence, you will freeze when someone is watching.

✦ PairPass

Ready to apply these patterns live? Practice with a FAANG engineer.

PairPass pairs you with a senior engineer from Google, Meta, or Amazon for a live mock interview. You'll work through real problems, get pattern-recognition coaching in real time, and walk away knowing exactly where your gaps are before the real thing.

Instant booking · 1-hour session · Money-back guarantee