Guided lesson

Sliding Window Pattern

Patterns

Sliding Window Pattern

Practice pattern

Mental model

  • Fixed window has constant-size movement.

Operations

expand right

Cost shape

Usually O(n)

Watch out

Shrinking too late or too early.

Related algorithms

Longest Substring Without Repeating CharactersMax Sum Subarray
Guided progression
10% lesson
Step 1 / 2Learner goal
Speech settings Speed 1.0 · Volume 90%

Keyboard: Space play/pause · Arrow keys step · Page Up/Down change sections · R restart