Search⌘ K
AI Features

Number of Spaces Cleaning Robot Cleaned

Understand how a cleaning robot moves through a 2D binary matrix representing a room, cleaning unique spaces by moving straight and turning upon obstacles or boundaries. Learn to track and count the cleaned spaces efficiently by simulating the robot's movement and detecting repeated states.

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 ...