Dynamic Point-in-Range Queries
Problem statement
Process an initially empty collection of closed integer intervals.
[0,left,right]inserts the interval[left,right].[1,point]asks whetherpointis covered by at least one interval inserted earlier.
Intervals may overlap and endpoints may be negative. Return one Boolean for every query operation, in operation order.
Function
processRangeQueries(operations: int[][]) → boolean[]Examples
Example 1
operations = [[0,1,5],[1,3],[1,6],[0,4,8],[1,6]]return = [true,false,true]Point 3 is covered by [1,5]; point 6 becomes covered only after inserting [4,8].
Example 2
operations = [[1,0],[0,-3,-1],[1,-2],[1,0]]return = [false,true,false]The first query occurs before any insertion. The negative interval covers -2 but not 0.
Example 3
operations = []return = []No queries produce no results.
Constraints
0 <= operations.length <= 200000.- An insert row has exactly three integers and satisfies
left <= right. - A query row has exactly two integers.
- Endpoints and query points are signed 32-bit integers.