A help line is open for m minutes, numbered 0 to m - 1. Each call calls[i] = [start, end] occupies every minute from start to end inclusive. A minute is crowded when at least k calls are active during it. Return the number of crowded minutes.
Examples
Input: m = 6, calls = [[0, 2], [1, 4], [2, 5]], k = 2
Output: 4
Explanation: active calls per minute are [1, 2, 3, 2, 2, 1]; minutes 1, 2, 3 and 4 have at least 2.
Input: m = 3, calls = [[0, 2]], k = 2
Output: 0
Constraints
1 <= m <= 10**5,0 <= len(calls) <= 10**5,1 <= k <= 10**50 <= start <= end < m- Target complexity: O(m + c) where c is the number of calls. Marking every minute of every call is too slow for the largest tests.
Goals
- Turn interval endpoints into +1/-1 marks
- Count positions whose running coverage meets a threshold