#3161
Block Placement Queries
grandmaster · 2240 · lc hard +32 · 18.4% accepted · 147 likes · top 1%
Description
On a non-negative number line, process two query types: type 1 [1, x] places an obstacle at position x; type 2 [2, x, sz] asks whether a block of length sz can be placed within [0, x] without intersecting any obstacle (touching is allowed). Return a boolean array of answers for all type-2 queries.
Code
1
2
3