hard
arrays
sliding-window
queue
You are given an array of integers nums and a window size k. The window of size k slides from the very left of the array to the very right, moving one position at a time. You can only see the k numbers inside the window.
Return an array of the maximum value in each window.
Examples
Example 1
Input: nums = [1,3,-1,-3,5,3,6,7], k = 3
Output: [3,3,5,5,6,7]
Example 2
Input: nums = [1], k = 1
Output: [1]
Example 3
Input: nums = [1,-1], k = 1
Output: [1,-1]
Running will execute all 3 cases.