Given an integer array nums and a window size k, slide the window from the left end of the array to the right end, one position at a time.
Return an array holding the maximum value inside the window at each position.
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]
Constraints
1 <= nums.length <= 10^5-10^4 <= nums[i] <= 10^41 <= k <= nums.length