249. Sliding Window Maximum

Hard · Sliding Window

Given an array `nums` and a sliding window of size `k`, return an array of the maximum value in each window position.

Examples

Example 1
Input: nums=[1,3,-1,-3,5,3,6,7], k=3
Output: [3,3,5,5,6,7]
Explanation: Maximum in each window of size 3

Constraints