Search⌘ K
AI Features

Number of Spaces Cleaning Robot Cleaned

Explore how to simulate a cleaning robot moving through a 2D binary matrix that represents a room with obstacles. Learn to apply matrix traversal techniques to track the robot’s path, identify when it revisits a space facing the same direction, and calculate the total unique spaces cleaned. This lesson develops problem-solving skills related to matrices and traversal logic.

Statement

You are given a 0-indexed 2D binary matrix, room, representing a room of size m×nm \times n. In this matrix, 00 represents an empty space, while ...