Concept Flow - Sliding Window Maximum Using Deque
Start with empty deque
For each element in array
Remove indices from deque back if their values < current element
Add current index to deque back
Remove front index if it is out of current window
If window is formed, record value at deque front as max
Repeat until end of array
Return list of max values
We keep indexes of useful elements in a deque, removing smaller elements and outdated ones, to find max in each sliding window.
