16 worked problems

Sliding Window

A moving range that grows and shrinks. The question asks about a contiguous range whose validity changes predictably as either edge moves.

Recognition signal

When should you think of Sliding Window?

The question asks about a contiguous range whose validity changes predictably as either edge moves.

Core invariant

What must stay true?

The current window and its frequency or aggregate state stay synchronized.

Practice in a deliberate order

What to learn in this cluster

  1. 01Fixed-size windows
  2. 02Variable windows with one constraint
  3. 03Frequency windows and monotonic deques

All Sliding Window problems

16 of 16 walkthroughs
Continue the cluster

Related patterns and study guides