Back to problems

Robot Straight-Line Reachable Cells on a 2D Grid with Blockers (8 Directions)

Algorithm · Pinterest · Medium

Problem Consider a rectangular width × height board whose cells use the following coordinate ranges: 0 ≤ x < width 0 ≤ y < height A robot is initially positioned at (x, y). It can travel in any of the eight compass directions—N, S, E, W, NE, NW, SE, or SW—but after selecting one, it must continue along that single straight path and may not change direction. A list named blockers identifies obstacle cells by coordinate. While traveling in a chosen direction, the robot: must…

Checking your access…