A robot cleaner interview question I was stuck on, how would you guys approach it?
Design a robot cleaner algorithm with 4 given APIs and a starting position in an unknown space (with obstacles in random locations)
The 4 APIs are:
clean(): clean the current location.
turnleft(k): turn left k*90 degrees.
turnrigt(k): turn right k*90 degrees.
move(): move forward for 1 position, return False if that’s not possible.
How do you clean the entire space?