Running Stream Aggregates
Problem statement
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.