Company: Amazon_26aug
Difficulty: medium
Subarray Median Count Problem Description Developers at Amazon are working on an application to test the reliability of servers. As a simulation, n requests are sent to the servers, and the size of the k th request is requests[k] units. Given an array, requests , and an integer, mid , count the number of subarrays in requests with a median of mid . Note: The median of an array is the middle value in that sorted array. If the size of the array is even, there are 2 middle values. In this case, the median is the element at the smaller of the two. A subarray is defined as any contiguous segment of the array. Complete the function getSubarrayMedian in the editor below. getSubarrayMedian has the following parameters: int mid : the target median int requests[] : the sizes of the requests Returns long int : the number of subarrays of requests with a median of mid Examples Example 1: Input: n = 3, requests = [1, 2, 3], mid = 2 All possible subarrays are: [1], [2], [3], [1,2], [2,3], [1,2,3] . L