Sliding Window Maximum
Hard📝 Description
Find max in each sliding window of size k (O(n) solution)
Input Format
First line: space-separated array Second line: window size k
Output Format
Array of maximums
Constraints
1 ≤ nums.length ≤ 10^5
🔍 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.
Results
Suggested Solution
Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run