Tap here to switch tabs
Problem
Submissions

Problem: Robot Bounded In Circle

med
30 min
Try to solve the Robot Bounded In Circle problem.

Statement

On an infinite plane, a robot is positioned at (0,0)(0, 0) and initially faces north. The robot receives a sequence of commands represented by a string instructions.

Each character in instructions represents one of the following actions:

  • 'G': Move forward 11 step in the current direction.

  • 'L': Turn 9090 degrees counterclockwise.

  • 'R': Turn 9090 degrees clockwise.

The robot performs the entire sequence of instructions in order, repeating it indefinitely.

Return true if there exists a circle in the plane that the robot never leaves, and false otherwise.

Constraints:

  • 1≤1 \le instructions.length ≤100\le 100

  • instructions[i] is 'G', 'L', or 'R'

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Robot Bounded In Circle

med
30 min
Try to solve the Robot Bounded In Circle problem.

Statement

On an infinite plane, a robot is positioned at (0,0)(0, 0) and initially faces north. The robot receives a sequence of commands represented by a string instructions.

Each character in instructions represents one of the following actions:

  • 'G': Move forward 11 step in the current direction.

  • 'L': Turn 9090 degrees counterclockwise.

  • 'R': Turn 9090 degrees clockwise.

The robot performs the entire sequence of instructions in order, repeating it indefinitely.

Return true if there exists a circle in the plane that the robot never leaves, and false otherwise.

Constraints:

  • 1≤1 \le instructions.length ≤100\le 100

  • instructions[i] is 'G', 'L', or 'R'