Sliding Window Maximum

Hard · Queue & Deque · about 25 minutes

Asked at Amazon, Google, Microsoft, Uber.

Given an integer array nums and a window size k, a window of size k slides from the left of the array to the right, one position at a time. Return the maximum of each window.

Related guides