Reported September 2026
Bloombergprefix sum

Running Stream Aggregates

Reported by candidates from Bloomberg's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Bloomberg OA. Under 2s to a working solution.
Founder's read

The edge case that breaks a naive solution on this Bloomberg OA, reported in September 2026, is initializing min and max to 0 instead of the first value. Running Stream Aggregates looks like a warmup. You get integer events and emit [count, sum, min, max] after each one. It's a single pass over an array, and the trap is small but real. With up to 200000 values and negative numbers allowed, sloppy init gives wrong rows on all-negative or all-positive input. If you blank mid-assessment, StealthCoder runs invisibly as a safety net and hands you the solution on screen.

The problem

Process integer events in arrival order. After each event, emit one row [count, sum, minimum, maximum] describing the prefix observed so far.
Return all emitted rows in arrival order.

Function
runningAggregates(values: int[]) → int[][]

Examples
Example 1
values = [5]
return = [[1,5,5,5]]
Case 1 exercises the documented deterministic contract.
Example 2
values = [1,2,3]
return = [[1,1,1,1],[2,3,1,2],[3,6,1,3]]
Case 2 exercises the documented deterministic contract.
Example 3
values = [-2,4,-1]
return = [[1,-2,-2,-2],[2,2,-2,4],[3,1,-2,4]]
Case 3 exercises the documented deterministic contract.

Constraints
1 <= values.length <= 200000.
-10^6 <= values[i] <= 10^6.
Every running sum fits a signed 32-bit integer.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is that there is no trick, only discipline. Keep four variables: count, sum, min, max. Seed min and max from values[0], not from 0 and not from a fake sentinel you forget to check. Then loop once, update each variable, and push a fresh array copy of the four numbers into the result. The common pitfall is pushing a reference to a shared array that you keep mutating, so every row ends up identical. Another is initializing min to 0, which breaks Example 3 with negatives, or max to 0, which breaks all-negative input. Time is O(n) and output space is O(n). The constraints promise the running sum fits in 32 bits, so overflow isn't your concern, though a wider type costs nothing. If the live OA makes you second-guess the init logic, StealthCoder is the hedge that shows a clean version fast.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Running Stream Aggregates cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Bloomberg's OA.

Bloomberg reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Running Stream Aggregates FAQ

How hard is Running Stream Aggregates really?+

Easy. It's one pass with four running values. The only way to lose is a careless initialization or reusing a mutable row. If you can write a loop and copy an array, you can finish this quickly and spend leftover time on edge cases.

What's the trick to the Bloomberg version?+

Seed min and max from the first element, then update them on every later value. Starting at 0 fails on all-negative or all-positive inputs. Emit a new array for each row so later iterations don't overwrite earlier output.

What edge cases should I test?+

Test a single element like [5], which should return [[1,5,5,5]]. Test all-negative input, mixed signs like [-2,4,-1], and repeated equal values. Also check that earlier rows stay unchanged after later iterations run.

What's the time and space complexity?+

Time is O(n) since you touch each value once and do constant work. Output space is O(n) because you return n rows of four integers. Extra working space beyond the output is O(1), just the four running variables.

How do I prepare for this in 48 hours?+

Write it once in your language, then run Example 3 by hand. Practice prefix-style single-pass problems where you emit state after each element. Focus on initialization and copying output rows rather than reading up on advanced data structures.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Bloomberg.

OA at Bloomberg?
Invisible during screen share
Get it