Position: L3
Location: Bangalore, India
Design a data structure with two operations 1. addRange(int start, int end) and 2. isPresent(int point)
Here range means an interval, so the data structure contains information of all ranges added uptil that point. contains(int point) returns true if the point is contained in any of the ranges or false otherwise.
How to do both operations with O(logn) complexity or better ?