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.
Arrays & Hashing
Use arrays, hash maps, and sets for fast keyed lookup across complements, counting, grouping, membership, positions, and deduplication.
Explore patternsTwo Pointers
Coordinate two indices around a movement invariant to eliminate candidates efficiently in sorted arrays, strings, partitions, and ranges.
Explore patternsSliding Window
Maintain a valid moving window while expanding and shrinking to optimize contiguous subarray and substring problems.
Explore patternsIntervals
Reason about overlap and boundaries across insertion, containment, coverage, scheduling, gaps, and other interval relationships.
Explore patternsMerge Intervals
Sort intervals and maintain a current merged range while combining overlapping or adjacent regions into a compact result.
Explore patternsIn-Place Linked List Manipulation
Preserve pointer reachability while reversing, splicing, partitioning, rotating, reordering, and deleting linked-list nodes in place.
Explore patternsK-Way Merge
Track one frontier candidate per sorted source to merge multiple lists, arrays, or streams efficiently with a heap.
Explore patternsModified Binary Search
Maintain a shrinking candidate interval across ordered lookup, boundaries, rotated arrays, peaks, and other monotonic structures.
Explore patternsBinary Search on the Answer
Search an answer space by building a monotonic feasibility test and locating the boundary between possible and impossible values.
Explore patternsSubsets & Combinatorial Generation
Build a combinatorial decision tree with include-or-exclude choices, iterative expansion, or bit masks to enumerate solution families.
Explore patternsGreedy Techniques
Make provably safe local choices using exchange arguments, dominance rules, or invariants that lead to a globally optimal result.
Explore patternsBacktracking
Explore a constrained search tree by choosing, recursing, pruning invalid paths, and undoing state as possibilities are tested.
Explore patternsOne-Dimensional Dynamic Programming
Define a one-dimensional state and derive its recurrence, base cases, evaluation order, and opportunities for memory compression.
Explore patternsTwo-Dimensional Dynamic Programming
Model problems with two-dimensional state when the solution depends on paired positions, grid coordinates, intervals, or progress dimensions.
Explore patternsCyclic Sort & Index Placement
Exploit a value-to-index mapping to place elements naturally and expose missing, duplicate, or displaced values in place.
Explore patternsMatrices & Grid Transformations
Treat grids as indexed 2D state for rotations, spiral traversals, row-column marking, layers, and in-place transformations.
Explore patternsStacks
Use last-in, first-out state to model nesting, parsing, unresolved obligations, simulations, path simplification, and deferred work.
Explore patternsMonotonic Stacks & Queues
Maintain candidates in monotonic order so dominated values disappear permanently in boundary, histogram, and range-extrema problems.
Explore patternsTree Depth-First Search
Define what each subtree returns upward or carries downward to solve traversal, validation, aggregation, and structural tree problems.
Explore patternsState Tracking & Invariants
Track the smallest sufficient state—counters, balances, positions, flags, or best-so-far values—needed to preserve a scan invariant.
Explore patternsBitwise Manipulation
Reason directly with binary representation using XOR, masks, shifts, bit counts, and bit-level state transformations.
Explore patternsDivide & Conquer
Split a problem into independent subproblems, solve each recursively, and combine their results through a structured recurrence.
Explore patterns