hard
Sliding Window Maximum
Given an integer array and a window size k, the window slides one position at a time from left to right. Return the maximum of each window position.
Constraints
- 1 ≤ n ≤ 10^5
- 1 ≤ k ≤ n
- -10^4 ≤ nums[i] ≤ 10^4
Examples
in: nums = [1,3,-1,-3,5,3,6,7], k = 3
out: [3,3,5,5,6,7]
Code it yourself
Solve in
Test execution is not yet available for this exercise.Practice journal →Draft saved in this browser.
Hints:
Which approach applies?
Choose an approach to check your pattern recognition, or reveal the discussion when you need help.