Skip to content
Problem patterns

Browse coding interview patterns

Choose a solution pattern and practice recognizing the structural signals that point toward it before reading the final algorithm.

Topics

Available topics

Choose a solution pattern and practice recognizing the structural signals that point toward it before reading the final algorithm.

foundation
3 articles

Arrays & Hashing

Use arrays, hash maps, and sets for fast keyed lookup across complements, counting, grouping, membership, positions, and deduplication.

Explore patterns
core-pattern
16 articles

Two Pointers

Coordinate two indices around a movement invariant to eliminate candidates efficiently in sorted arrays, strings, partitions, and ranges.

Explore patterns
core-pattern
3 articles

Sliding Window

Maintain a valid moving window while expanding and shrinking to optimize contiguous subarray and substring problems.

Explore patterns
core-pattern
1 article

Intervals

Reason about overlap and boundaries across insertion, containment, coverage, scheduling, gaps, and other interval relationships.

Explore patterns
core-pattern
1 article

Merge Intervals

Sort intervals and maintain a current merged range while combining overlapping or adjacent regions into a compact result.

Explore patterns
core-pattern
9 articles

In-Place Linked List Manipulation

Preserve pointer reachability while reversing, splicing, partitioning, rotating, reordering, and deleting linked-list nodes in place.

Explore patterns
intermediate
1 article

K-Way Merge

Track one frontier candidate per sorted source to merge multiple lists, arrays, or streams efficiently with a heap.

Explore patterns
core-pattern
6 articles

Modified Binary Search

Maintain a shrinking candidate interval across ordered lookup, boundaries, rotated arrays, peaks, and other monotonic structures.

Explore patterns
intermediate
1 article

Binary Search on the Answer

Search an answer space by building a monotonic feasibility test and locating the boundary between possible and impossible values.

Explore patterns
core-pattern
1 article

Subsets & Combinatorial Generation

Build a combinatorial decision tree with include-or-exclude choices, iterative expansion, or bit masks to enumerate solution families.

Explore patterns
intermediate
3 articles

Greedy Techniques

Make provably safe local choices using exchange arguments, dominance rules, or invariants that lead to a globally optimal result.

Explore patterns
intermediate
13 articles

Backtracking

Explore a constrained search tree by choosing, recursing, pruning invalid paths, and undoing state as possibilities are tested.

Explore patterns
intermediate
5 articles

One-Dimensional Dynamic Programming

Define a one-dimensional state and derive its recurrence, base cases, evaluation order, and opportunities for memory compression.

Explore patterns
advanced
10 articles

Two-Dimensional Dynamic Programming

Model problems with two-dimensional state when the solution depends on paired positions, grid coordinates, intervals, or progress dimensions.

Explore patterns
core-pattern
1 article

Cyclic Sort & Index Placement

Exploit a value-to-index mapping to place elements naturally and expose missing, duplicate, or displaced values in place.

Explore patterns
core-pattern
4 articles

Matrices & Grid Transformations

Treat grids as indexed 2D state for rotations, spiral traversals, row-column marking, layers, and in-place transformations.

Explore patterns
core-pattern
2 articles

Stacks

Use last-in, first-out state to model nesting, parsing, unresolved obligations, simulations, path simplification, and deferred work.

Explore patterns
intermediate
2 articles

Monotonic Stacks & Queues

Maintain candidates in monotonic order so dominated values disappear permanently in boundary, histogram, and range-extrema problems.

Explore patterns
core-pattern
17 articles

Tree Depth-First Search

Define what each subtree returns upward or carries downward to solve traversal, validation, aggregation, and structural tree problems.

Explore patterns
core-pattern
18 articles

State Tracking & Invariants

Track the smallest sufficient state—counters, balances, positions, flags, or best-so-far values—needed to preserve a scan invariant.

Explore patterns
intermediate
2 articles

Bitwise Manipulation

Reason directly with binary representation using XOR, masks, shifts, bit counts, and bit-level state transformations.

Explore patterns
advanced
1 article

Divide & Conquer

Split a problem into independent subproblems, solve each recursively, and combine their results through a structured recurrence.

Explore patterns