Home
Topics
Practice
Roadmap
DSA Tracker
Code Editor
Tech Blogs
More
Sign in
Get started
Loading question...
Feedback
Sliding Window Maximum
Hard
00:00
0 users online
Share
Description
Solution
Submissions
Discussion
Find maximum value in each sliding window of size k.
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 outside window from front
Hint 3
Remove smaller elements from back
Code Editor
Reset
Run
Save
Loading...