Sliding Window

The Sliding Window pattern is used to perform operations on a specific window size of an array or linked list, such as finding the longest subarray matching a condition.


Common Variants

  1. Fixed Window Size: Sliding window of constant width .
  2. Dynamic Window Size: Expanding the right boundary until conditions are violated, then shrinking the left boundary.

Solved Problems