Return the maximum of the minimums over every length-x window of an array.
Unlock detailed company stats for this questionUpgrade
Given an array A of size n and an integer x, consider every continuous subarray of length x, find the minimum element in each window, and return the maximum among all those minimums.
Example: A = [1, 3, -1, 5, 3, 6], x = 3. Windows: [1, 3, -1] -> min -1; [3, -1, 5] -> -1; [-1, 5, 3] -> -1; [5, 3, 6] -> 3. Answer = 3.
Core pattern: sliding window with a monotonic deque.
Format · Technical interview.
Community answers
No answers contributed by the community yet.
Related questions
For every window of size k, find the minimum, then return the maximum among all those minimums.Find the maximum of every sliding window of size k in an array (Sliding Window Maximum).Find the maximum and minimum median over all length-k subsequences of an array.Related courses

Course

Course
Course
