Home
Topics
Practice
Roadmap
DSA Tracker
Code Editor
Tech Blogs
More
Sign in
Get started
Loading question...
Feedback
Sliding Window Maximum
Medium
00:00
0 users online
Share
Description
Solution
Submissions
Discussion
Given an array and window size k, return the maximum value in each sliding window.
Sample Input:
[1,3,-1,-3,5,3,6,7], 3
Sample Output:
[3,3,5,5,6,7]
Hints
Hint 1
Use deque to maintain potential maximums
Hint 2
Remove elements from front if they are outside window
Hint 3
Remove elements from back if they are smaller than current
Code Editor
Reset
Run
Save
Loading...