You are given a time-ordered sequence of events. Each event has:
type
(string or int)
ts
(timestamp as integer milliseconds/seconds)
A streak segment is a maximal contiguous subsequence of the input where:
type
, and
A streak segment is a super streak if it satisfies all of the following:
Implement a function that returns the number of super streak segments in the sequence.
ts
ascending.
T
,
N
, and
X
are given as non-negative values.
T
is allowed.
If a segment has 5 events of the same type, all adjacent gaps , and spans from time 10 to 25, then it is a super streak iff and .
How would you adapt your solution if parameters N, T, and/or X can change over time (e.g., different thresholds apply to different portions of the event sequence)?