Concepts4
⚙️AlgorithmIntermediate
Invariant Maintenance
An invariant is a property you promise to keep true throughout an algorithm, and it is the anchor of both design and correctness proofs.
#invariant#loop invariant#search invariant+12
⚙️AlgorithmIntermediate
Mo's Algorithm
Mo's algorithm answers many range queries offline by reordering them to minimize pointer movement along the array.
#mo's algorithm#offline queries#range queries+12
⚙️AlgorithmIntermediate
Sliding Window
Sliding window is a technique that moves a contiguous segment (window) across an array or string while maintaining some running information like sum, count, or max.
#sliding window#two pointers#variable window+11
⚙️AlgorithmIntermediate
Two Pointers
Two pointers is a pattern where two indices move through a sequence in a coordinated, usually monotonic way to avoid unnecessary work.
#two pointers#sliding window#opposite ends+12