Company: ibm_7nov
Difficulty: medium
Maximum Subarray Minimum Problem Description Implement a function that, for an array of integers arr and a subarray of size k , determines the maximum among the minimums of all contiguous subarrays of size k . The function maximumSubarrayMinimum takes the following input: int arr[] : an array of integers int k : the subarray length The function should return an integer, the largest value amongst all minimums of subarrays of size k . Note: A subarray is an array obtained by deleting several (possibly zero) elements from the beginning and end of the original array. Examples Example 1: Input: n = 5, arr = [1, 2, 3, 4, 5], k = 2 Output: 4 Explanation: For subarray size k = 2 , the subarrays are [1, 2] , [2, 3] , [3, 4] , and [4, 5] , and their minima are [1, 2, 3, 4] . The final answer is 4 , the maximum of these. Example 2: Input: n = 5, arr = [1, 2, 3, 1, 2], k = 3 Output: 3 Explanation: Each element of arr = [1, 2, 3, 1, 2] is an array of size k = 1 and its minimum. The maximum of these