Intro

The sliding window technique for contiguous subarrays.

Sliding window maintains a contiguous range of elements, expanding and shrinking to find optimal subarrays or substrings.

The core insight: Instead of recomputing from scratch for each starting position (O(n2)O(n^2)), update incrementally as the window slides (O(n)O(n)).

I'll teach you fixed-size windows, variable-size windows, and common patterns like "longest substring with condition" and "minimum window containing." You'll learn when sliding window applies and how to implement it without bugs.