Loading...
Given an integer array nums and a window size k, consider every contiguous window of exactly k consecutive elements of nums.
Each window has a minimum element. Return the maximum among the minimums of all windows.
Input: nums = [1, 3, -1, 5, 3, 6], k = 3
Output: 3
Explanation:
Window [1 3 -1] 5 3 6 → min -1
Window 1 [3 -1 5] 3 6 → min -1
Window 1 3 [-1 5 3] 6 → min -1
Window 1 3 -1 [5 3 6] → min 3
The largest of the window minimums is 3.
Input: nums = [4, 2, 7], k = 1
Output: 7
Explanation: Each window is a single element, so the answer is the largest element.
nums.length ≤105nums[i] ≤109nums.lengthClick "Run" to test with sample cases or "Submit" to run all tests.