A robot starts at (0, 0) facing north. It follows a string of instructions repeatedly forever: 'G' moves forward unit, 'L' turns left °, 'R' turns right °. Determine if the robot stays bounded in a circle (never drifts to infinity). This is a well-known Google interview question that tests your ability to simulate and find cycle conditions.
For instructions = "GG", the robot walks north forever. Not bounded. For instructions = "GL", it walks a square. Bounded.
Before looking at the solution, think: what conditions after one execution of the instructions guarantee the robot won't drift away?
Constraints: .