Robot Bounded In Circle

Medium · Math & Number Theory · about 15 minutes

Asked at Amazon, Google, LinkedIn, Microsoft.

A robot starts at (0, 0) facing north and repeats the instructions forever: 'G' moves one step forward, 'L' turns 90° left and 'R' turns 90° right. Return true if the robot stays within some circle (it never leaves a bounded region).