Let say I have a list of ranges like this
[[1,3], [2,5], [4,6], [8,10], [12,15], [13,17]]
Now I want to find a range say [3,11]
falls in. My algorithm should give me all the ranges this range falls to. For example the output for this should be
Output - [1,3], [2,5], [4,6], [8,10]
How do i go about solving this?
PS: I know segment tree might be helpful. Where I can build the tree to store interval and query a Point lying inside interval, but how to get all intervals given a interval.