Mental Model
Keep track of the largest values in a moving window using a special list that quickly removes smaller values.
Analogy: Imagine watching runners in a race through a window. You only care about the fastest runner visible. When a new runner enters, you ignore slower runners behind the fastest one to always know the leader.
Array: [2, 1, 3, 4, 6, 3, 8, 9, 10, 12, 56] Window size = 4 Deque stores indexes of elements in decreasing order of their values Example: Deque: [4, 5] -> points to values [6, 3] Window: [3, 4, 6, 3]
