Calculate the maximum number of overlapping intervals with some conditions about operations:
- Insert an interval: O(logN)
- Remove an interval: O(logN)
- Calculate(the maximum number of overlapping intervals): O(1)
I think this problem can be solved by using avl tree (suitable for Insert and Remove operations) but I dont know how to design avl tree to satisfy requirement of Calculate operation.
Edit: Example: [start, end)
Input: [1,2),[3,4),[1,6),[3,6),[6,7)
Output: 3