Mental Model
Keep track of the largest values in a window using a special list that quickly removes smaller values.
Analogy: Imagine a line of people waiting to buy tickets, but only the tallest people stay in line because shorter ones get blocked and leave. The tallest person at the front is always the biggest in the group.
Array: [2, 1, 3, 4, 6, 3, 8, 9, 10, 12, 56] Window size k=4 Deque stores indexes of elements in decreasing order of values Deque: front -> [indexes of biggest elements] -> back Example: Deque: [3, 4, 6] means values: [4, 6, 8]
