Sliding Window Technique: From O(n·k) Scans to O(n) in One Pass
Mar 29 · 20 min read · TLDR: Instead of recomputing a subarray aggregate from scratch on every shift, maintain it incrementally — add the incoming element, remove the outgoing element. For a fixed window this costs O(1) per
Join discussion

























