DSA7 min read
The Sliding Window Pattern
In this article we will learn what the sliding window pattern is, how it turns an O(n²) brute force into an O(n) scan, the difference between fixed-size and variable-size windows, how to recognise a sliding window problem from its wording, and the mistakes that quietly break the invariant.