Company: jpmc_27july
Difficulty: medium
Maximum of Minimums Problem Description Given an array, for each subarray of a specified length, find the smallest element in the subarray. Among all these smallest elements, determine the largest one. The subarrays are formed by taking consecutive elements starting from each position in the array, with each subarray having the specified length. The last valid subarray ends exactly at the last element of the array. Complete the maxMin function in the editor with the following parameter(s): int arr[n] : an array of integers int k : the subarray length The function is expected to return an INTEGER indicating the maximum of the minima of the subarrays. int maxMin(vector arr, int k) 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]. 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 = 1 Output: 3 Explanation: