The same handful of ideas solve problems filed under wildly different categories. Each technique page teaches the core move, shows how to recognize when a problem wants it, and links every problem in the set that drills it — across categories.
Precompute a running total so any range answer becomes a single subtraction; pair the prefix with a hash map of seen sums to answer subarray questions in O(n) — even with negatives, where windows fail.
technique ↗Keep a stack or deque whose values stay sorted; the element that breaks the order triggers pops, and each pop resolves an answer — next greater/smaller, the bounding wall, the window extreme — in O(n) amortized.
technique ↗Two pointers at different speeds over a sequence: the hare laps the tortoise inside any cycle (Floyd), the slow one lands on the middle, and a reset finds the loop's entrance — all in O(1) space.
technique ↗Stop searching the array and bisect the answer space instead: find the smallest/largest value where a monotone predicate feasible(x) flips. The whole skill is spotting the predicate and writing feasible().
technique ↗Maintain a forest where each element points toward a representative root; find with path compression and union by rank answer "are these connected?" and "how many groups?" online in near-O(1) amortized.
technique ↗Seed the BFS queue with every source at distance 0 at once, then expand in layers — the first time any cell is reached gives its distance to the nearest source, all in one O(V+E) sweep.
technique ↗