Pattern Taxonomy

Algorithmic Patterns & Solving Techniques

Technical interviews test repeatable problem-solving techniques rather than memorized solutions. Explore the canonical taxonomy of algorithmic patterns, their core intuition, and vetted practice problems.

Patterns: 84
Categories: 20
Mapped Problems: 313

Arrays

3 patterns

Backtracking

6 patterns

Bit Manipulation

2 patterns

Divide & Conquer

1 pattern

Dynamic Programming

12 patterns

0/1 Knapsack

DP where each item may be used at most once, choosing a subset that hits or approaches a target.

2 problems
2M

Circular Array DP

Handle a circular adjacency constraint by reducing to two linear DP passes that each exclude one end.

1 problem
1M

Expand Around Center

Treat every index (and gap between indices) as a palindrome center and expand outward while it still matches.

2 problems
2M

Grid / 2D Path DP

DP over a 2D grid where each cell's value depends on cells reachable by the allowed moves (down/right, etc.).

6 problems
5M1H

Interval DP

DP over subarray/substring ranges [i, j], combining results of smaller sub-ranges to solve larger ones.

1 problem
1H

Linear 1D DP

A DP recurrence over a single sequence where each state depends on a small fixed window of previous states.

8 problems
3E5M

Longest Increasing Subsequence DP

DP (optionally with binary search) tracking the best increasing subsequence length ending at each index.

1 problem
1M

Minimax Game State DP

DP where state represents game configuration (remaining piles, positions, turns) and we compute win/loss from each state assuming optimal play from both players.

12 problems
6M6H

State Machine DP

DP tracking which of several explicit states (e.g. holding/not-holding stock, in/out of cooldown) you're in at each step.

3 problems
1M2H

String Alignment / Subsequence DP

2D DP over two string indices to compare, align, or count subsequences/substrings between them.

7 problems
4M3H

Take/Skip Adjacent-Constraint DP

DP where taking an element forbids taking its immediate neighbor, tracking best-with/without-current at each step.

2 problems
2M

Unbounded Knapsack

DP where each item/coin can be reused an unlimited number of times while building toward a target.

3 problems
3M

Graphs

10 patterns

BFS Shortest Path (Unweighted)

Standard BFS where each edge has equal weight, so the first time a node is reached is guaranteed shortest.

3 problems
2M1H

Bounded-Hop Shortest Path (Bellman-Ford Style)

Relax edges for a limited number of rounds (bounding the number of hops/stops) rather than running unbounded Dijkstra, since the constraint makes plain Dijkstra unsound.

1 problem
1M

Dijkstra's Shortest Path

Priority-queue-driven shortest path on a weighted graph with non-negative edges, greedily finalizing the closest node.

1 problem
1M

Flood Fill

Recursively (or iteratively) spread a fill from a starting cell to all connected cells matching a condition.

3 problems
3M

Graph DFS Traversal

DFS across an explicit or implicit graph (adjacency list) to visit, clone, or reconstruct connected structure.

3 problems
2M1H

Grid DFS Traversal

DFS across grid cells following adjacency (usually 4-directional), typically to explore or measure a connected region.

5 problems
4M1H

Minimum Spanning Tree (Prim's/Kruskal's)

Build a minimum-weight tree connecting all nodes, either by growing from a frontier (Prim's) or sorting edges and using union-find (Kruskal's).

1 problem
1M

Multi-Source BFS

Seed the BFS queue with multiple starting nodes simultaneously so distances propagate from all sources in lockstep.

3 problems
3M

Topological Sort

Order nodes of a DAG so every directed edge points from earlier to later, via DFS post-order or Kahn's algorithm.

3 problems
2M1H

Union-Find / Disjoint Set

Maintain disjoint sets with union and find operations to detect connectivity or cycles as edges are processed.

4 problems
3M1H

Greedy

6 patterns

Hashing

3 patterns

Heap

3 patterns

Intervals

1 pattern

Linked List

5 patterns

Math

4 patterns

Matrix

1 pattern

Sliding Window

2 patterns

Stack

4 patterns

Strings

2 patterns

Trees

12 patterns

BST Ordering Property

Exploit the left-less-than-node-less-than-right invariant of a BST to prune search space or produce sorted output.

6 problems
2E4M

Binary Indexed Tree (Fenwick Tree)

Use a BIT/Fenwick tree to answer prefix sum queries or range queries with point updates in O(log n) time, typically when the operation is associative and invertible.

3 problems
1M2H

Complete Tree Structural Binary Search

Exploit a tree's complete (heap-shaped) structure to binary search for where the last level ends, unrelated to BST ordering.

1 problem
1E

Generic Recursive Tree DFS

Plain recursive depth-first traversal used to transform or visit every node, where no more specific tree pattern applies.

2 problems
1E1M

Lowest Common Ancestor

Find the deepest node that is an ancestor of two given nodes, via recursive search or BST-property comparison.

2 problems
2M

Segment Tree Range Queries

Build a segment tree to answer range queries (sum, min, max, etc.) or perform range updates in O(log n) time, often with lazy propagation.

3 problems
3H

Tree BFS / Level-Order Traversal

Process a tree level-by-level using a queue, tracking level boundaries as needed.

5 problems
1E4M

Tree Height / Balance Check

Compute subtree heights bottom-up during DFS to check depth or balance conditions, often with early termination.

2 problems
2E

Tree Path Value Accumulation

Carry a running value down (or aggregate a value up) a root-to-leaf or arbitrary path during DFS.

5 problems
2E2M1H

Tree Reconstruction from Traversals

Rebuild a binary tree from two given traversal orders by using one to locate roots and the other to size subtrees.

2 problems
2M

Tree Serialization / Deserialization

Encode a tree into a linear representation (e.g. preorder with null markers) and decode it back into the same structure.

1 problem
1H

Tree Structural Comparison

Recursively compare two trees (or a tree against a mirrored version of itself) node-by-node for structural/value equality.

3 problems
3E

Tries

1 pattern

Two Pointers

3 patterns