Back to problems

Robot Bounded In Circle

Algorithm · Uber · Medium

Problem: Robot Path Confined to a Circle A robot receives a string named instructions containing only the characters 'G', 'L', and 'R': 'G': advance one unit in the direction the robot is currently facing; 'L': rotate 90 degrees counterclockwise; 'R': rotate 90 degrees clockwise. Initially, the robot is located at (0, 0) and points north. It executes the full instruction string repeatedly without end. Decide whether its trajectory remains inside some circle of finite size.…

Checking your access…