Skip to content

Coding Concepts

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

ConceptWhat it helps you notice
Array ScansLinear pass tactics for reading an array once, carrying just enough state, and avoiding nested loops.
Two PointersTwo-index tactics for shrinking search space while preserving an invariant between positions.
Fast and Slow PointersPointer-speed tactics for cycle detection, middle finding, and linked-list distance constraints.
Sliding WindowContiguous-range tactics for maintaining a valid subarray or substring while endpoints move forward.
Prefix SumsAccumulation tactics for answering range-sum and subarray-count questions from differences between checkpoints.
Difference ArraysRange-update tactics that mark changes at boundaries and recover final values with a prefix scan.
Hash Map CountingFrequency-table tactics for turning membership, complement, and multiplicity questions into direct lookups.
Sorting as PreprocessingOrder-first tactics that pay O(n log n) so adjacency, monotonic movement, or greedy choice becomes visible.

Search and Ranges

ConceptWhat it helps you notice
Binary SearchMonotonic search tactics for cutting a sorted or ordered search space in half until one answer remains.
Binary Search on AnswerFeasibility-search tactics for finding the smallest or largest value that satisfies a monotonic condition.
Modified Binary SearchBinary-search variants for rotated arrays, peak finding, and data where the ordering is present but disguised.
IntervalsRange-boundary tactics for overlap, containment, scheduling, and sweep-line problems.
Merge IntervalsSorted-boundary tactics for combining overlapping ranges and maintaining the current covered span.

Optimization and DP

ConceptWhat it helps you notice
Greedy AlgorithmsLocal-choice tactics for solving optimization and reachability problems when a provable invariant protects the future.
Greedy Exchange ArgumentsProof tactics for showing that a greedy choice can be swapped into an optimal solution without making it worse.
Dynamic ProgrammingState-and-transition tactics for solving overlapping subproblems with cached answers.
MemoizationTop-down caching tactics for preserving recursive clarity while avoiding repeated subproblem work.
TabulationBottom-up DP tactics for filling states in dependency order without recursion.
State CompressionDP memory tactics for keeping only the previous states needed for the next transition.
Knapsack PatternsChoose-or-skip DP tactics for capacity, subset, and target-sum problems.
Sequence DPOrder-aware DP tactics for strings and arrays where prefixes or positions define reusable states.
Grid DPRow-column DP tactics for paths, matrix states, and local moves with directional dependencies.
ConceptWhat it helps you notice
BacktrackingSearch-tree tactics for exploring choices, undoing state, and pruning invalid branches.
Subsets and CombinationsChoice-set tactics for generating selected groups while controlling duplicates and order.
PermutationsOrdering tactics for generating arrangements where the same items in a different order are different answers.
Constraint SearchPruned search tactics for problems where each choice must satisfy local and global constraints.
RecursionSelf-similar problem-solving tactics for trees, divide-and-conquer, and search branches.
Divide and ConquerSplit-solve-combine tactics for reducing a problem into independent smaller pieces.

Graphs and Trees

ConceptWhat it helps you notice
Tree TraversalRecursive and iterative tactics for visiting tree nodes with path, depth, or structural state.
DFSDepth-first traversal tactics for exploring one branch fully before backtracking to alternatives.
BFSBreadth-first traversal tactics for level order, shortest unweighted paths, and expanding frontiers.
Graph TraversalVisited-state tactics for exploring nodes, edges, components, and reachability relationships.
Topological SortDependency-order tactics for DAGs, prerequisites, and detecting cycles in directed graphs.
Union FindDisjoint-set tactics for tracking connected components as edges arrive.
Shortest PathsPath-cost tactics for finding minimum distance, time, risk, or transformation count through a graph.
DijkstraNon-negative weighted shortest-path tactics using a priority queue frontier.
Bellman-FordRepeated-relaxation tactics for shortest paths with negative edges, bounded stops, or layered constraints.
Flood FillGrid traversal tactics for expanding through adjacent cells that share a condition.

Specialized Structures

ConceptWhat it helps you notice
Heap and Priority QueuePriority-frontier tactics for repeatedly extracting the smallest, largest, or most urgent item.
Top KSelection tactics for finding the largest, smallest, or most frequent K items without fully ordering everything.
K-way MergeMulti-stream ordering tactics for combining several sorted sources through one priority queue.
Monotonic StackOrdered-stack tactics for nearest greater, nearest smaller, and span-style questions.
Monotonic QueueDeque tactics for maintaining a window minimum or maximum as the window slides.
Stack ParsingLast-open-first-closed tactics for nested syntax, expressions, and reversible operations.
Trie Prefix SearchPrefix-tree tactics for sharing common string prefixes and pruning word search branches.

Bits, Math, and Simulation

ConceptWhat it helps you notice
Bit ManipulationBinary-representation tactics for masks, toggles, arithmetic shortcuts, and set-like operations.
Bitmask StateCompact-state tactics for representing chosen items, visited sets, and small DP dimensions as integer masks.
Linked List Pointer RewiringNode-link tactics for changing list structure without losing the rest of the chain.
Cycle DetectionRepeated-state tactics for finding loops in linked lists, graphs, arrays, and numeric processes.
SimulationState-machine tactics for faithfully executing rules while keeping state small and explicit.
Math and Number TheoryArithmetic tactics for problems driven by divisibility, digits, modular behavior, and numeric identities.

References