← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
You are given couriers, where couriers[i] = [start, end] represents the working interval of the ith courier. start is inclusive and end is exclusive.
Intervals may overlap. Return a list of timeline segments [segmentStart, segmentEnd, activeCount] such that:
activeCount is the number of couriers working throughout the entire segment.activeCount > 0 should appear in the output.
If multiple couriers start or end at the same time, treat all changes at that timestamp together before moving to the next segment.From 1 to 3, one courier is active. From 3 to 5, both are active. From 5 to 7, only the second courier remains.
Because intervals are [start, end), the courier ending at 3 is not active at time 3, while the two couriers starting at 3 are.