Concepts3
⚙️AlgorithmIntermediate
Prefix Sum and Difference Array
Prefix sums precompute running totals so any range sum [l, r] can be answered in O(1) time as prefix[r] - prefix[l-1].
#prefix sum#difference array#imos method+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