A sliding window maintains a contiguous subarray that "slides" through the array. You track the window using two pointers: and . There are two variants:
Fixed-size window: the window always has exactly elements. You slide it one position at a time.
Variable-size window: the window grows and shrinks based on some condition. Both achieve by processing each element at most twice: once when entering the window, once when leaving.