Loading...
Given an integer array nums and a window size k, consider every contiguous window of exactly k consecutive elements of nums.
nums
k
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
nums[i]