Robot Room Cleaner

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
Read
1
InterviewGPT

AI-powered tools to help you succeed in tech interviews — from resume to offer.

Interview Solver

  • Coding Puzzles
  • System Design
  • Behavioral Challenges
  • ML System Design
  • SQL Puzzles
  • FE System Design
Explore Solver

Question Bank

  • Coding Interview Questions
  • System Design Interview Questions
  • Behavioral Interview Questions
  • ML System Design Questions
  • SQL & Database Questions
  • FE System Design Questions
Explore Questions

Golden Blogs

  • Coding Solutions
  • System Design Guides
  • Behavioral Guides
  • ML System Design Guides
  • SQL Solutions
  • FE System Design Guides
Explore Blogs

Intervipedia

  • Coding Concepts
  • System Design Concepts
  • Behavioral Concepts
  • ML System Concepts
  • SQL Concepts
  • FE System Concepts
Explore Concepts

Application Tools

  • Self-Intro Generator

Company

  • Pricing
  • FAQ
  • About
  • Privacy Policy
  • Terms of Service

© 2026 InterviewGPT Inc. All rights reserved.

All systems operationalUS-East

Made with ♥ for developers