Open ishu9bansal opened 4 years ago
Write an efficient method to insert an interval in a data structure and get all the ranges intersecting with a given range. The runtime should be proportional to the size of the intersection result.
A combination of interval tree and start end timestamp maps should do the trick Implementation: https://ideone.com/yUB1Pq
https://leetcode.com/problems/my-calendar-ii/submissions/
Write an efficient method to insert an interval in a data structure and get all the ranges intersecting with a given range. The runtime should be proportional to the size of the intersection result.