Sliding Window
Solve fixed-window problems: maximum sum of k elements, moving averages, and O(n) updates as the window slides.
Precompute running totals so the sum of any range can be answered instantly instead of adding it up every time.
Count how many contiguous subarrays add up to a target value.
Return an array where each element is the product of every other element, without using division.
Find the longest contiguous subarray with an equal number of 0s and 1s.
Answer repeated queries for the sum of values inside a rectangle of a fixed grid.
Check whether a contiguous subarray of size at least two sums to a multiple of k.
Find the longest contiguous subarray that sums to exactly k.
Solve fixed-window problems: maximum sum of k elements, moving averages, and O(n) updates as the window slides.
Scan a sorted array or string from both ends at once to find pairs, remove duplicates, or reverse data in O(n).
Cut a sorted range in half on every step to find a value or boundary in O(log n) instead of checking one by one.
Explore as far as possible down one path before backtracking, used to walk trees, graphs, and grids.
Explore level by level from a starting point, the go-to way to find the shortest path in an unweighted graph.
Break a problem into overlapping subproblems and reuse their answers to avoid recomputing the same work.