Uber Senior Software Engineer Screening Round Interview Experience
Question Details
Problem Statement Determine the coordinates of all robots within a 2D grid that satisfy specific distance constraints in four cardinal directions.
Inputs 1.
Grid Map: A matrix containing t
Full Details
Problem Statement Determine the coordinates of all robots within a 2D grid that satisfy specific distance constraints in four cardinal directions.
Inputs 1.
Grid Map: A matrix containing three entity types: * O: Robot * E: Empty space * X: Blocker 2.
Query Array: A set of four integers [Left, Top, Bottom, Right] representing the exact distance a robot must traverse before hitting a blocker or the grid boundary.
Constraints & Rules *
Blockers: Both X markers and the outer boundaries of the grid function as blockers. *
Distance Calculation: The distance is measured as the number of empty spaces or robot positions
passed before encountering a blocker.
Example Data *
Query Requirements: [2, 2, 4, 1] * Left: 2 spaces * Top: 2 spaces * Bottom: 4 spaces * Right: 1 space *
Grid Configuration: | O | E | E | E | X | | :--- | :--- | :--- | :--- | :--- | | E | O | X | X | X | | E | E | E | E | E | | X | E | O | E | E | | X | E | X | E | X |
Solution Logic To solve, iterate through the grid to identify all O coordinates. For each robot found, verify if the distance to the nearest X or grid edge matches the query array for all four directions.
Return the coordinates of the robots that fulfill every directional requirement.
About This Question
This is a reported interview question from a uber interview for a swe role (senior level) reported in 2025.