Sliding Window Maximum

Hard

📝 Description

Find the maximum in each sliding window of size k

Input Format

Array of integers and window size k

Output Format

Array of maximums

Constraints

1 ≤ nums.length ≤ 10^5 1 ≤ k ≤ nums.length

🔍 Sample Input

[1,3,-1,-3,5,3,6,7]
3
            

✅ Sample Output

[3,3,5,5,6,7]
            

Code Editor

Please login to run and submit code.

Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run