Fixed Window Extrema
Fixed Window Extrema When To Use Use this when every query is over a fixed-size window and you need the max or min.
Fixed Window Extrema When To Use Use this when every query is over a fixed-size window and you need the max or min.
Prefix Sum Candidates When To Use Use this when candidates are prefix indices and the deque keeps the best prefix sums.
Variable Window Max Min When To Use Use this when a variable-size window is valid based on the current max and min.
Contribution By Boundary When To Use Use this when summing over all subarrays and each element contributes as the minimum or maximum over some range.
Farthest Candidate Stack When To Use Use this when you need the farthest valid index, not the nearest greater/smaller index.
Greedy Remove Stack When To Use Use this when building a lexicographically smallest/largest subsequence while you are allowed to drop elements.
Histogram Expansion When To Use Use this when choosing an index as the minimum height/value and expanding as far as possible improves the objective.
Exactly K via At Most Template Use this when counting subarrays/substrings with exactly k of something.
Fixed Size Window Template Use this when every candidate window must have exactly size k.
Last Seen Jump Left When To Use Use this when duplicates can be handled by jumping l directly instead of removing one element at a time.