Pattern catalog
Each card is a technique: cues, template, and a problem path. Status chip top-right; path inventory under the title (for example “6 guides and a template”); your completion counts sit on the right once you start.
Showing 1 to 37 of 37
Sliding Window
Longest, shortest, or valid contiguous ranges over arrays and strings.
6 guides and a template
Two Pointers
Sorted arrays, pair conditions, or coordinated movement from both ends.
6 guides and a template
Fast & Slow Pointers
Linked-list cycles, middle nodes, and fixed pointer gaps.
6 guides and a template
Binary Search
Halve a sorted or monotonic search space until you pin the answer.
6 guides and a template
Binary Search on Answer
Binary search the answer value itself; check if a candidate is feasible in linear time.
6 guides and a template
Hashing
O(1) average lookup, frequency counting, grouping, and complement checks.
6 guides and a template
Prefix Sum
Precompute running sums so any range sum is O(1); pair with maps for subarray sum counts.
6 guides and a template
Difference Array
Range updates in O(1); rebuild the array with a prefix pass.
6 guides and a template
Monotonic Stack
Next greater/smaller, histogram rectangles, and temperature waits.
6 guides and a template
Stack Parsing
Nested structures, expressions, paths, and collision simulation.
6 guides and a template
Queue & Deque
FIFO processing, sliding-window extrema, and recent-event tracking.
6 guides and a template
Intervals
Sort by start or end, then merge, insert, or remove overlaps.
6 guides and a template
Heap & Top K
Repeated extract-min/max or maintain the K best under a stream.
6 guides and a template
Grid & Graph BFS
Shortest paths in unweighted graphs and multi-source floods on grids.
6 guides and a template
Backtracking
Choose, explore, undo. Build all valid combinations or search with pruning.
6 guides and a template
Tree DFS
Define what each subtree returns to its parent.
6 guides and a template
Tree BFS
Level-order processing for width, views, and per-level aggregates.
6 guides and a template
Trie
Prefix trees for dictionaries, word search, and shared prefixes.
6 guides and a template
Union Find
Dynamic connectivity: merge components and query same-set fast.
6 guides and a template
Topological Sort
Order nodes so every directed edge goes from earlier to later.
6 guides and a template
Greedy
Make the best local choice when you can prove it never ruins the global optimum.
6 guides and a template
One-Dimensional DP
Define dp[i] clearly, then relate it to smaller indices.
6 guides and a template
Two-Dimensional DP
State depends on two changing indices (grid, two strings, two pointers in DP).
6 guides and a template
Knapsack & Subset DP
Choose items under a capacity or hit an exact sum/target.
6 guides and a template
Bit Manipulation
XOR, masks, shifts, and set-bit tricks for O(1) state.
6 guides and a template
Graph DFS
Connected components, flood fill, cycle detection, paths.
6 guides and a template
Shortest Path (Weighted)
Dijkstra, Bellman-Ford: minimum cost in a weighted graph.
6 guides and a template
Sweep Line
Process events sorted by coordinate; detect overlaps/skyline.
6 guides and a template
Segment Tree / BIT
Point update, range query in O(log n); prefix sums with mutation.
6 guides and a template
Quick Select
Partition-based selection: kth smallest, top K in O(n) average.
6 guides and a template
Linked List Manipulation
Reversal, in-place merge, dummy head, splice, and partition.
6 guides and a template
Math & Number Theory
Modular arithmetic, primes, GCD/LCM, combinatorics, sieve.
6 guides and a template
Meet in the Middle
Split input in half, enumerate each, merge results. For n ~ 40.
6 guides and a template
Bitmask DP
DP with bitmask state: TSP-style, assignment, subset transitions.
6 guides and a template
KMP / String Matching
Linear-time pattern matching via failure function; rolling hash.
6 guides and a template
Minimum Spanning Tree
Kruskal / Prim: connect all nodes at minimum total edge cost.
6 guides and a template
Reservoir Sampling
Uniform sampling from a stream of unknown length. R-eviction.
6 guides and a template