Company: Typeface_10sep
Difficulty: medium
Pipeline Response Time Sum Problem Description An array responseTime of n software components is given, where responseTime[i] represents the time taken by the i th component to complete its task. A subarray of components is called a pipeline. The response time of a pipeline is defined as: Pipeline Response Time = (Maximum Response Time in the Pipeline) × (Number of Components in the Pipeline) Return the sum of these response times for all possible pipelines modulo (10 9 + 7). Complete the function getResponseTimeSum in the editor with the following parameter(s): int responseTime[n]: the response times of each software component Returns: int: the sum of response times of all subgroups of n components modulo (10 9 + 7). Examples Example 1: n = 3 responseTime = [2, 3, 4] The response times of the pipelines are: [2]: 2 * 1 = 2 [3]: 3 * 1 = 3 [4]: 4 * 1 = 4 [2, 3]: 3 * 2 = 6 [3, 4]: 4 * 2 = 8 [2, 3, 4]: 4 * 3 = 12 The sum of response times = 2 + 3 + 4 + 6 + 8 + 12 = 35. Return 35 modulo (10