Number-Line Obstacles and Block Checks
Problem statement
Process operations on an infinite integer number line:
[1, x]permanently inserts an obstacle at x.[2, x, size]checks whether every coordinate from x through x + size - 1 is obstacle-free, without changing state.
Append 1 for a successful check and 0 otherwise. Return all check results as one binary string.
Function
processObstacleQueries(queries: int[][]) → StringExamples
Example 1
queries = [[1,2],[2,0,2],[2,0,3],[1,5],[2,3,3]]return = "100"[0,1] is free, [0,2] contains obstacle 2, and [3,5] contains obstacle 5.
Example 2
queries = [[2,-2,3]]return = "1"No obstacles exist yet.
Constraints
1 <= queries.length <= 100000- Inserted coordinates are distinct.
- The total size across check queries is at most 1000000.