Learn AP Comp Sci

Problem of the Day

Wednesday, September 3, 2025


Problem:

A robotic rover on the surface of Mars has a steering system that has malfunctioned so that it can't turn left--it can only go forward (F) or turn right (R). The rover is currently facing north, as shown. What series of commands should be issued so that the rover can follow the path indicated here to arrive at the finish?

  1. F R R R F R F F R F
  2. F R F R R R F F R R R F
  3. F R R R F R R F
  4. The rover can't follow that path

Show solution:

The correct answer is a.

Although the rover can't turn immediately left with its broken steering, it can turn right three times so it it ends up facing left. It's not terribly efficient, but it does allow the rover to move as needed.