Problem
Given an array and window size k, return the max value in each window as the window slides from left to right.
References
Difficulty
🔴 Hard
Companies
Amazon, Google, DE Shaw
Notes
Language: Java
Naive O(nk) won't pass. Use a monotonic deque (ArrayDeque) for O(n).
Problem
Given an array and window size k, return the max value in each window as the window slides from left to right.
References
Difficulty
🔴 Hard
Companies
Amazon, Google, DE Shaw
Notes
Language: Java
Naive O(nk) won't pass. Use a monotonic deque (ArrayDeque) for O(n).