Find the maximum element in every window of size k as it slides across the array. Uses a monotonic deque to maintain candidates — each element is added and removed at most once.
time:O(n)
space:O(k)
⚡ +200_XP
step[1/23]
> Start
L
1
3
R
-1
-3
5
3
6
7
▸Find the maximum in every sliding window of size k=3. Use a deque to track candidates in O(n).
// tap NEXT STEP to walk through one step at a time