ishu9bansal / ideone

useful pieces of codes
1 stars 1 forks source link

Interval Intersection #9

Open ishu9bansal opened 4 years ago

ishu9bansal commented 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.

ishu9bansal commented 4 years ago

A combination of interval tree and start end timestamp maps should do the trick Implementation: https://ideone.com/yUB1Pq

ishu9bansal commented 2 years ago

https://leetcode.com/problems/my-calendar-ii/submissions/