Week 2 · Day 8 of 42

Sliding Window: Fixed Size

If the problem gives you a fixed window size k and asks for max/min/average of a subarray — use a fixed sliding window. Slide both ends together, add the new element, remove the old one.

Checking access

Spotted a mistake on this page?

Wrong formula, broken animation or confusing wording. Tell us and we will fix it.