Coding concepts are the tactics behind the problem catalog. A problem category tells you where a problem lives. A concept page tells you what mental move makes the solution work.
The same problem can link to several concepts. That overlap is intentional. 3Sum is sorting as preprocessing plus two pointers. Course Schedule is graph traversal plus topological sort plus cycle detection. Sliding Window Maximum is sliding window plus monotonic queue. The links should explain the transferable ideas, not force every problem into one bucket.
How to use these pages
- Start with the terminology clues when you are stuck on a prompt.
- Check “When not to use it” before committing to a pattern.
- Use the problem links as drills for that tactic.
- Add a problem backlink under
## Related concepts when a page clearly exercises the concept.
Linear and Ordered Data
| Concept | What it helps you notice |
|---|
| Array Scans | Linear pass tactics for reading an array once, carrying just enough state, and avoiding nested loops. |
| Two Pointers | Two-index tactics for shrinking search space while preserving an invariant between positions. |
| Fast and Slow Pointers | Pointer-speed tactics for cycle detection, middle finding, and linked-list distance constraints. |
| Sliding Window | Contiguous-range tactics for maintaining a valid subarray or substring while endpoints move forward. |
| Prefix Sums | Accumulation tactics for answering range-sum and subarray-count questions from differences between checkpoints. |
| Difference Arrays | Range-update tactics that mark changes at boundaries and recover final values with a prefix scan. |
| Hash Map Counting | Frequency-table tactics for turning membership, complement, and multiplicity questions into direct lookups. |
| Sorting as Preprocessing | Order-first tactics that pay O(n log n) so adjacency, monotonic movement, or greedy choice becomes visible. |
Search and Ranges
| Concept | What it helps you notice |
|---|
| Binary Search | Monotonic search tactics for cutting a sorted or ordered search space in half until one answer remains. |
| Binary Search on Answer | Feasibility-search tactics for finding the smallest or largest value that satisfies a monotonic condition. |
| Modified Binary Search | Binary-search variants for rotated arrays, peak finding, and data where the ordering is present but disguised. |
| Intervals | Range-boundary tactics for overlap, containment, scheduling, and sweep-line problems. |
| Merge Intervals | Sorted-boundary tactics for combining overlapping ranges and maintaining the current covered span. |
Optimization and DP
| Concept | What it helps you notice |
|---|
| Greedy Algorithms | Local-choice tactics for solving optimization and reachability problems when a provable invariant protects the future. |
| Greedy Exchange Arguments | Proof tactics for showing that a greedy choice can be swapped into an optimal solution without making it worse. |
| Dynamic Programming | State-and-transition tactics for solving overlapping subproblems with cached answers. |
| Memoization | Top-down caching tactics for preserving recursive clarity while avoiding repeated subproblem work. |
| Tabulation | Bottom-up DP tactics for filling states in dependency order without recursion. |
| State Compression | DP memory tactics for keeping only the previous states needed for the next transition. |
| Knapsack Patterns | Choose-or-skip DP tactics for capacity, subset, and target-sum problems. |
| Sequence DP | Order-aware DP tactics for strings and arrays where prefixes or positions define reusable states. |
| Grid DP | Row-column DP tactics for paths, matrix states, and local moves with directional dependencies. |
Recursive Search
| Concept | What it helps you notice |
|---|
| Backtracking | Search-tree tactics for exploring choices, undoing state, and pruning invalid branches. |
| Subsets and Combinations | Choice-set tactics for generating selected groups while controlling duplicates and order. |
| Permutations | Ordering tactics for generating arrangements where the same items in a different order are different answers. |
| Constraint Search | Pruned search tactics for problems where each choice must satisfy local and global constraints. |
| Recursion | Self-similar problem-solving tactics for trees, divide-and-conquer, and search branches. |
| Divide and Conquer | Split-solve-combine tactics for reducing a problem into independent smaller pieces. |
Graphs and Trees
| Concept | What it helps you notice |
|---|
| Tree Traversal | Recursive and iterative tactics for visiting tree nodes with path, depth, or structural state. |
| DFS | Depth-first traversal tactics for exploring one branch fully before backtracking to alternatives. |
| BFS | Breadth-first traversal tactics for level order, shortest unweighted paths, and expanding frontiers. |
| Graph Traversal | Visited-state tactics for exploring nodes, edges, components, and reachability relationships. |
| Topological Sort | Dependency-order tactics for DAGs, prerequisites, and detecting cycles in directed graphs. |
| Union Find | Disjoint-set tactics for tracking connected components as edges arrive. |
| Shortest Paths | Path-cost tactics for finding minimum distance, time, risk, or transformation count through a graph. |
| Dijkstra | Non-negative weighted shortest-path tactics using a priority queue frontier. |
| Bellman-Ford | Repeated-relaxation tactics for shortest paths with negative edges, bounded stops, or layered constraints. |
| Flood Fill | Grid traversal tactics for expanding through adjacent cells that share a condition. |
Specialized Structures
| Concept | What it helps you notice |
|---|
| Heap and Priority Queue | Priority-frontier tactics for repeatedly extracting the smallest, largest, or most urgent item. |
| Top K | Selection tactics for finding the largest, smallest, or most frequent K items without fully ordering everything. |
| K-way Merge | Multi-stream ordering tactics for combining several sorted sources through one priority queue. |
| Monotonic Stack | Ordered-stack tactics for nearest greater, nearest smaller, and span-style questions. |
| Monotonic Queue | Deque tactics for maintaining a window minimum or maximum as the window slides. |
| Stack Parsing | Last-open-first-closed tactics for nested syntax, expressions, and reversible operations. |
| Trie Prefix Search | Prefix-tree tactics for sharing common string prefixes and pruning word search branches. |
Bits, Math, and Simulation
| Concept | What it helps you notice |
|---|
| Bit Manipulation | Binary-representation tactics for masks, toggles, arithmetic shortcuts, and set-like operations. |
| Bitmask State | Compact-state tactics for representing chosen items, visited sets, and small DP dimensions as integer masks. |
| Linked List Pointer Rewiring | Node-link tactics for changing list structure without losing the rest of the chain. |
| Cycle Detection | Repeated-state tactics for finding loops in linked lists, graphs, arrays, and numeric processes. |
| Simulation | State-machine tactics for faithfully executing rules while keeping state small and explicit. |
| Math and Number Theory | Arithmetic tactics for problems driven by divisibility, digits, modular behavior, and numeric identities. |
References