Robot Room Cleaner
You are controlling a robot in a room represented as an m \times n binary grid. 0 represents a wall and 1 represents an empty slot. The robot starts at an unknown location, which is guaranteed to be empty. You do not have access to the grid directly, but you can control the robot via an API. The API provides the following methods:
boolean move(): The robot attempts to move one step in its current direction. Returns true if successful, or false if it hits a wall. void turnLeft() / void turnRight(): The robot turns 90 degrees in place. void clean(): The robot cleans the current cell. Design an algorithm to clean the entire room. The robot initially faces 'Up'. All boundaries of the grid are walls. Your solution should track visited cells using relative coordinates.JavaDFSBacktrackingHashSet
00