Algorithm · Apple · Medium
We are given n closed time intervals, where intervals[i] = [start_i, end_i]. Each interval belongs to one user who is online continuously from the timestamp start_i through the timestamp end_i, endpoints included. All timestamps are integers, and start_i <= end_i for every interval. For an integer time t, define count(t) as the number of intervals that cover t. Describe how this count evolves by splitting the timeline into blocks on which the count does not change. Represent…
Checking your access…