
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
How about using a data structure such as deque (double-ended queue)?
The queue size need not be the same as the window’s size.
Remove redundant elements and the queue should store only elements that need to be considered.