Build Blocks and Obstacles

Problem Overview

  • Process operations on an infinite number line: place an obstacle at a free point, or check if a block of given size can end just before x with no obstacles; return '1' or '0' per check.
  • Inputs: up to 1e5 operations with coordinates in [-1e9, 1e9] and sizes ≤ 1e9; Output: a binary string for all type-2 queries.
  • Domain: simulates building blocks and obstacles on a line, ensuring segments are clear before building.
  • An Uber interviews coding interview problem and interview question focused on efficient query processing.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: