Ordered Window
Ordered Window When To Use Use this when the active window needs ordered queries like min, max, median, or closest value.
Ordered Window When To Use Use this when the active window needs ordered queries like min, max, median, or closest value.
Prefix Sum + Hashmap When To Use Use this instead of sliding window when the array can contain negative numbers or the target condition is not monotonic.
Rolling Hash / String Matching Window When To Use Use this when every window has fixed length, but comparing raw strings or full frequency arrays would be too expensive.
Shrink While Valid Template Use this when you need the smallest valid window.
Variable Size: Maintain Invariant My bias in Max Consecutive Ones III I simulated the operation instead of maintaining an invariant.
Fast Slow Pointer Intuition Both pointer will move through the non-cycle part, then once inside the cycle, they have a relative speed of one for covering the gap between them so in ācā steps they will definitely meet.
Merge Sorted Sources When To Use Use this when consuming two sorted arrays, lists, or interval streams.
Opposite Ends When To Use Use this when two pointers start at opposite ends and each move has a local reason to discard one side.
Partition Around Pivot When To Use Use this when separating values into groups in-place.
Same Direction Read Write When To Use Use this when compacting, filtering, overwriting, or partitioning in-place.