Company: High Radius_23aug
Difficulty: medium
Add K Time Series Problem Description A monitoring system records K discrete time series. Each time series is a list of (time, value) pairs, called spikes. A spike at time time with magnitude value sets the magnitude of that series to value , and the magnitude stays the same until the next spike of the same series sets a new one. Before its first spike, a series has magnitude 0 . For example, let T1 = [(0,1), (3,5), (7,2)] and T2 = [(2,2), (3,3), (6,1)] . T1 has magnitude 1 on [0,3) , 5 on [3,7) and 2 on [7,inf) . T2 has magnitude 0 on [0,2) , 2 on [2,3) , 3 on [3,6) and 1 on [6,inf) . At every moment, the magnitude of the sum is the sum of the magnitudes of the series. Adding T1 and T2 gives the time series [(0,1), (2,3), (3,8), (6,6), (7,3)] . (inferred -- the source text says T2 has value 2 on [0,2). That line contradicts both the source's own result [(0,1), (2,3), (3,8), (6,6), (7,3)] and its sample output, which both need T2 to be 0 before its first spike at time 2. This statement