Practice Block Placement Queries
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Process queries on the nonnegative number line. A query [1, x] adds an obstacle at x, where none currently exists. A query [2, x, sz] asks whether a block of length sz can fit entirely within [0, x] without an obstacle in its interior; touching an obstacle is allowed. These checks do not actually place blocks or affect later queries. Return the booleans for type-2 queries in order.
Source: Block Placement Queries on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
queries = [[1,2],[2,3,3],[2,3,1],[2,2,2]]
[false,true,true]
# Example 2
queries = [[1,7],[2,7,6],[1,2],[2,7,5],[2,7,6]]
[true,true,false]
Constraints
Related LeetCode Problems
Practice more problems similar to Block Placement Queries.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.