FastPrepSum of Pipeline Response Times
Problems/Sum of Pipeline Response Times

Sum of Pipeline Response Times

Bloomberg LP logoBloomberg LP● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: This is the third coding task in the same post about a Bloomberg online assessment for 2027 full-time roles. It asks for one total, taken mod 10^9 + 7 and added up over every group of components, where a group scores its size times its slowest response time. The post works one example.

That example does not fit the rule. For [2, 3, 5] it lists six groups with a total of 41 and skips the group [2, 5]. All seven groups give 51. The six it lists are exactly the runs of neighbors, so the author may have meant those. But the stated rule covers any group, so here every group counts and the example shows 51. Equal times on different components still count as different groups. The limits (10^5 components, times up to 10^9) are our choice.

Our version is about 75% the same as the reported question.

A system has n components. Component i has response time responseTime[i].

Any non-empty group of components forms a pipeline. The components in a group do not need to be next to each other, and their order does not matter. The response time of a pipeline is the largest response time in it multiplied by the number of components in it.

Add up the response times of all 2^n - 1 pipelines. Components with equal times are still different components, so groups that use different components count separately.

Return the sum modulo 10^9 + 7.

Function

totalPipelineResponseTime(responseTime: int[]) → int

Examples

Example 1

responseTime = [2,3,5]return = 51

There are 7 non-empty pipelines:

  • [2]: 2 x 1 = 2
  • [3]: 3 x 1 = 3
  • [5]: 5 x 1 = 5
  • [2, 3]: 3 x 2 = 6
  • [2, 5]: 5 x 2 = 10
  • [3, 5]: 5 x 2 = 10
  • [2, 3, 5]: 5 x 3 = 15

The total is 2 + 3 + 5 + 6 + 10 + 10 + 15 = 51.

Example 2

responseTime = [3,1,2]return = 31

The order of the components does not matter. The 7 pipelines give: [3] 3, [1] 1, [2] 2, [3, 1] 3 x 2 = 6, [3, 2] 3 x 2 = 6, [1, 2] 2 x 2 = 4, and [3, 1, 2] 3 x 3 = 9.

The total is 3 + 1 + 2 + 6 + 6 + 4 + 9 = 31.

Example 3

responseTime = [4,4]return = 16

The two components are different even though their times are equal. Each one alone gives 4, and both together give 4 x 2 = 8.

The total is 4 + 4 + 8 = 16.

Example 4

responseTime = [1000000000,1000000000,1000000000]return = 999999923

Every pipeline has a largest time of 1000000000. The three single components give 1000000000 each, the three pairs give 2000000000 each, and the whole group gives 3000000000.

The total is 3000000000 + 6000000000 + 3000000000 = 12000000000. Taken modulo 10^9 + 7, that is 12000000000 - 11 x 1000000007 = 999999923.

Constraints

  • 1 <= responseTime.length <= 10^5
  • 1 <= responseTime[i] <= 10^9

More Bloomberg LP interview questions

  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Longest Distance in a Frequency-Limited NetworkOA · Seen Sep 2026
  • Maximum Redundancy After One Segment FlipOA · Seen Sep 2026
  • Merge IntervalsOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
  • Design an Ordered StreamOA · PHONE SCREEN · ONSITE INTERVIEW · Seen May 2026
  • Count Teams Outscoring a Target TeamOA · Seen Feb 2023
  • Ashley Loves Numbers (Financial Engineer)OA · Seen Nov 2019
  • Consecutive Sum (Financial Engineer Intern)OA · Seen Nov 2019
  • Find Longest ChainOA · Seen Sep 2017
  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Product of Subset MaximaArcesium · OAArcesium interview questions
  • Capping Portfolio WeightsCapstone Investment Advisors · OA
  • Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions
  • Macaron Order PriceOpenAI · OAOpenAI interview questions
  • Get Triplet CountIBM · OAIBM interview questions
  • Linear InterpolatorTwo Sigma · OATwo Sigma interview questions
  • Count Reverse-Digit PairsVisa · OAVisa interview questions
  • Get Triplet CountPoint72 · OAPoint72 interview questions
  • Stable Robot ConfigurationsAmazon · OA
  • REST API: Energy BarRippling · OARippling interview questions

Bloomberg LP interview experiences

  • Bloomberg SWE Phone Screen and Onsite: 1 Experience
  • Bloomberg SWE Phone Screens with Two Teams: 1 Experience
  • Bloomberg AI Interview, Hiring Level Not Reported: 2 Experiences
  • Bloomberg Experienced SWE AI Coding Interviews: 2 Experiences
  • Bloomberg New Grad AI-Assisted Coding Rounds: 3 Experiences
  • Bloomberg New Grad SWE AI-Assisted Coding Rounds: 1 Experience
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public int totalPipelineResponseTime(int[] responseTime) {
        // Write your code here.
    }
}
Checking account…