Cleaning Robot

Problem Overview

  • Compute how many grid squares a cleaning robot will clean in this problem.
  • Input: String[] R (N rows, M cols) with '.' empty and 'X' blocked; robot starts at (0,0) facing right; Output: int count of cleaned squares; constraints unspecified.
  • Robot moves straight while possible; when blocked, rotates 90° clockwise and continues indefinitely; any visited square counts as clean.
  • Real-world robotics/grid navigation; from Microsoft interviews; a coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: