LeetCode Problems by Pattern: A Pattern-Wise List

All 310 LeetCode problems FaangPrep teaches, grouped by the pattern that solves them. Search for a problem to see which pattern it belongs to, then open its lesson to watch the solution run step by step.

To learn the patterns themselves first, each heading links to its pattern page, and the patterns cheat sheet has a code template and the signals for each. Problems on the Blind 75 and the NeetCode 150 are marked B75 and NC150.

310 problems

Two Pointers (35)

Hash Map (20)

Sliding Window (20)

Intervals (8)

Linked List (22)

Stack (22)

Binary Search (18)

Heap / Priority Queue (12)

Depth-First Search (37)

Breadth-First Search (15)

Backtracking (14)

Graphs (Topological Sort) (12)

Dynamic Programming (38)

Greedy Algorithms (16)

Trie (4)

Prefix Sum (5)

Matrices (3)

Bit Manipulation (9)

Finding the pattern

How do I identify the pattern in a LeetCode problem?

Read the input and what is asked before thinking about code. A sorted array or "pair with sum" points to two pointers; "longest or shortest contiguous subarray" to a sliding window; "k-th largest" or "top k" to a heap; "all combinations or permutations" to backtracking; "minimum steps" on a grid or graph to BFS; "number of ways" or "best value" built from smaller answers to dynamic programming. These are starting points, not rules: check that the pattern actually handles the constraints.

Can one problem use more than one pattern?

Yes. Many problems combine two, for example binary search on the answer with a greedy check, or a hash map inside a sliding window. This list puts each problem under the pattern its main idea uses; the lesson explains the rest.

Should I solve problems by pattern or at random?

Learning by pattern is faster at first, because each problem reuses the idea from the one before it. Once the patterns are familiar, mix them up, since an interview will not tell you which pattern to use.

How is this different from the Blind 75 or the NeetCode 150?

Those are fixed lists chosen by their authors. This page is every problem FaangPrep teaches, grouped by pattern, and it grows as lessons are added. Problems on those lists are marked so you can follow either one here.