Track Coverage of Half-Open Real Intervals. Implement RangeModule, initially tracking no numbers. addRange(left,right) includes every real x with left<=x<right.
### Problem
Implement RangeModule, initially tracking no numbers. addRange(left,right) includes every real x with left<=x<right. removeRange stops tracking that interval. queryRange returns whether every real number in the requested interval is tracked. Overlapping additions form a union.
```cpp
class RangeModule {
public:
RangeModule();
void addRange(int left, int right);
bool queryRange(int left, int right);
void removeRange(int left, int right);
};
```
### Examples
**Example 1:**
```text
RangeModule(); addRange(2,9); removeRange(4,6); queryRange(2,4); queryRange(3,7); queryRange(6,9)
Query returns: [true,false,true]
Explanation: Coverage is [2,4) together with [6,9).
```
**Example 2:**
```text
RangeModule(); addRange(1,3); addRange(3,5); queryRange(1,5)
Query returns: [true]
Explanation: Touching half-open ranges leave no uncovered real point.
```
### Constraints
- Endpoints satisfy 1 <= left < right <= 1000000000.
- Total calls across addRange, queryRange and removeRange are at most 10000.
### Contract considerations
Keep the original constructor and three persistent methods.
```hint Read the boundary condition
Can disjoint covered intervals answer a range query with one predecessor lookup?
```
### Boundary reminders
Keep the original constructor and three persistent methods.
Overview: Track Coverage of Half-Open Real Intervals. Implement RangeModule, initially tracking no numbers. addRange(left,right) includes every real x with left<=x<right.
Implement RangeModule, initially tracking no numbers. addRange(left,right) includes every real x with left<=x<right. removeRange stops tracking that interval. queryRange returns whether every real number in the requested interval is tracked. Overlapping additions form a union.
class RangeModule {
public:
RangeModule();
void addRange(int left, int right);
bool queryRange(int left, int right);
void removeRange(int left, int right);
};
Examples
Example 1:
RangeModule(); addRange(2,9); removeRange(4,6); queryRange(2,4); queryRange(3,7); queryRange(6,9)
Query returns: [true,false,true]
Explanation: Coverage is [2,4) together with [6,9).
Example 2:
RangeModule(); addRange(1,3); addRange(3,5); queryRange(1,5)
Query returns: [true]
Explanation: Touching half-open ranges leave no uncovered real point.
Constraints
Endpoints satisfy 1 <= left < right <= 1000000000.
Total calls across addRange, queryRange and removeRange are at most 10000.
Contract considerations
Keep the original constructor and three persistent methods.
Boundary reminders
Keep the original constructor and three persistent methods.