Company: Amazon_1_Feb
Difficulty: medium
API Request Throttling API Request Throttling Problem Description In Amazon's web infrastructure, the system logs n API requests per second, recording each request's response time in the array responseTimes , where each element denotes the time taken to respond to a single request. To prevent system overload, a throttling mechanism is applied with the following behaviour: In each step, select the request with the minimum response time. This request is prioritised for further analysis. Remove the selected request and its immediate neighbours in the array (based on original indices) from the logs permanently. This process continues until all requests are removed. The task is to calculate the total cumulative response time of all selected minimum requests over the entire throttling process. Note: If multiple requests have the same minimum response time, select the one with the lowest index. Example Input: n = 6 responseTimes = [4, 2, 9, 1, 7, 3] Output: 6 Explanation: We can simulate the