Concept Flow - Sliding Window Maximum Using Deque
Start with empty deque
For each element in array
Remove indices from back if current element >= elements at those indices
Add current index to back
Remove front if it is out of current window
If window is formed, record element at front as max
Move to next element
Repeat until end of array
The deque keeps indices of elements in decreasing order. For each new element, remove smaller or equal elements from back, add current index, remove front if out of window, then record max from front.
