Company: Amazon_18march
Difficulty: medium
1 ≤ size of responseTimes[] ≤ 10 5 1 ≤ responseTimes[i] ≤ 10 9 Sample Case 0 Sample Input For Custom Testing STDIN Function ----- -------- 7 -> responseTimes[] size is 7 6 -> responseTimes = [6, 4, 9, 10, 34, 56, 54] 4 9 10 34 56 54 Sample Output 68 Explanation Simulating the throttling mechanism. We maintain an active[] array where 1 = active, 0 = removed. Initially: active = [1, 1, 1, 1, 1, 1, 1] Select 4, remove its neighbours 6 and 9: active = [0, 0, 0, 1, 1, 1, 1] Select 10, remove its neighbour 34: active = [0, 0, 0, 0, 0, 1, 1] Select 54, remove its neighbour 56: active = [0, 0, 0, 0, 0, 0, 0] Total cumulative response time = 4 + 10 + 54 = 68. Sample Case 1 Sample Input For Custom Testing STDIN Function ----- -------- 8 -> responseTimes[] size is 8 132 -> responseTimes = [132, 45, 65, 765, 345, 243, 75, 67] 45 65 765 345 243 75 67 Sample Output 1120 Explanation Simulating the throttling mechanism. We maintain an active[] array where 1 = active, 0 = removed. Initially: active = [