Browse by Pattern

Recurring algorithmic blueprints top tech companies test in coding interviews.

22 patterns·4,583 problems
Time ComplexityBig O

Loops, recursion, space & complexity trade-offs

Python EssentialsCheatsheet

Dicts, heaps, matrices, binary search & templates

Advanced & DP

1D Dynamic Programming

Linear recurrence relations, state machines, and optimal decision subproblems

563 questions·14E 281M 268H
Top:Google, Amazon, Microsoft, Meta
Advanced & DP

2D Dynamic Programming & Knapsack

Grid optimization, 0/1 knapsack, and dual string alignments

562 questions·13E 280M 269H
Top:Google, Amazon, Microsoft, Meta
Advanced & DP

Greedy Algorithms

Making locally optimal choices that guarantee global optimal outcomes

432 questions·42E 295M 95H
Top:Amazon, Google, Microsoft, Bloomberg
Trees & Graphs

Tree Breadth-First Search (BFS)

Level-order traversal and horizontal tier exploration using queues

381 questions·40E 235M 106H
Top:Google, Amazon, Meta, Microsoft
Trees & Graphs

Tree Depth-First Search (DFS)

Recursive top-down and bottom-up traversals on hierarchical structures

351 questions·40E 223M 88H
Top:Google, Amazon, Meta, Microsoft
Fundamentals

Binary Search & Modified BS

Logarithmic O(log N) search on sorted spaces, monotonic predicates, and answers

318 questions·34E 178M 106H
Top:Google, Amazon, Meta, Microsoft
Trees & Graphs

Matrix & Grid Traversal

Coordinate navigation, spiral unwrapping, and 2D cellular automations

251 questions·36E 150M 65H
Top:Google, Amazon, Microsoft, Meta
Advanced & DP

Bit Manipulation

O(1) low-level bitwise operations, masks, and XOR parity tricks

238 questions·45E 110M 83H
Top:Google, Amazon, Microsoft, Meta
Fundamentals

Two Pointers

Opposite or parallel pointers traversing sequences in linear time O(N)

221 questions·60E 132M 29H
Top:Google, Amazon, Meta, Microsoft
Fundamentals

Prefix Sum & Hash Map

O(1) range queries and subarray sum lookups using cumulative totals

220 questions·18E 141M 61H
Top:Google, Amazon, Microsoft, Meta
Data Structures

Top K Elements & Priority Queues

Tracking extremes, medians, and K largest/smallest elements in dynamic streams

194 questions·15E 105M 74H
Top:Google, Amazon, Meta, Microsoft
Trees & Graphs

Graph Traversal (BFS & DFS)

Shortest paths, flood fills, and connected components in arbitrary networks

172 questions·3E 87M 82H
Top:Google, Amazon, Microsoft, Meta
Fundamentals

Sliding Window

Dynamic and fixed-size windows over contiguous subarrays or substrings

141 questions·17E 88M 36H
Top:Google, Amazon, Meta, Microsoft
Advanced & DP

Backtracking & Exhaustive Search

Combinations, permutations, and constraint satisfaction through pruned search trees

115 questions·3E 77M 35H
Top:Google, Amazon, Microsoft, Meta
Data Structures

Union-Find (Disjoint Set)

Connectivity, cycle detection, and clustering in undirected networks

90 questions·1E 50M 39H
Top:Google, Amazon, Meta, Microsoft
Data Structures

Monotonic Stack & Queue

Nearest greater/smaller elements and range extremums in linear time

86 questions·2E 49M 35H
Top:Google, Amazon, Microsoft, Meta
Fundamentals

Linked List In-Place Manipulation

Reversing, reordering, and partitioning pointer chains with O(1) space

71 questions·11E 52M 8H
Top:Amazon, Google, Microsoft, Meta
Data Structures

Trie (Prefix Tree)

Efficient prefix matching, autocomplete, and dictionary lookups

51 questions·4E 26M 21H
Top:Google, Amazon, Microsoft, Meta
Data Structures

Intervals & Overlap Scheduling

Managing overlapping timelines, meeting rooms, and range merges

41 questions·3E 27M 11H
Top:Google, Amazon, Microsoft, Bloomberg
Trees & Graphs

Binary Search Tree (BST)

Ordered hierarchical storage with monotonic inorder traversal

39 questions·9E 26M 4H
Top:Google, Amazon, Meta, Microsoft
Trees & Graphs

Topological Sort (Kahn's & DFS)

Linear dependency ordering and cycle detection in Directed Acyclic Graphs (DAG)

39 questions·1E 15M 23H
Top:Google, Amazon, Meta, Microsoft
Fundamentals

Fast & Slow Pointers

Cycle detection and midpoint traversal using Floyd's Tortoise and Hare algorithm

7 questions·4E 3M 0H
Top:Microsoft, Google, Amazon, Bloomberg

Why Learn LeetCode Coding Patterns?

Rather than memorizing hundreds of disconnected questions, learning patterns enables you to solve any unseen interview problem.

Recognize Signals

Identify key problem clues: sorted array points to Two Pointers or Binary Search; contiguous subarray points to Sliding Window; shortest path points to BFS.

Reusable Templates

Apply standard algorithmic blueprints that handle complex loop conditions, off-by-one errors, and pointer boundaries reliably.

FAANG Relevance

Over 85% of interview questions asked at Google, Meta, Amazon, Apple, and Microsoft map directly to these 22 foundational patterns.