A server log lists downloads as closed intervals [start, end] in whole seconds: the download is active during every second from start to end inclusive. Return the largest number of downloads active during any single second. A download ending at second t and another starting at second t are both active at t.
Examples
Input: downloads = [[1, 5], [5, 9], [2, 5], [10, 12]]
Output: 3
Explanation: At second 5 the first three downloads are all active.
Input: downloads = [[1, 2], [3, 4]]
Output: 1
Constraints
0 <= len(downloads) <= 5 * 10**4,0 <= start <= end <= 10**9.- Closed intervals: touching downloads overlap for one second.
- Target complexity: O(n log n).
Goals
- Convert intervals into start and end events
- Order events at equal times so closed intervals are counted correctly
- Track the running count and its maximum