help

Revision en1, by accountforcheating, 2020-02-25 16:50:51

A robot stands at (0,0), with its back against an infinite wall defined by y = 0. It can receive one of three instructions: 1. “G”: go straight 1 unit 2. “L”: turn 90 degrees to the left 3. “R”: turn 90 degrees to the right

The robot performs the instructions given in order, and repeats them till it encounters the wall again. Return true if and only if a final position exists.

Note: 1. 1 <= instructions.length <= 100 2. instructions[i] is in {‘G’, ‘L’, ‘R’}

Output Format: "0" for false (without "") "1" for true (without "") Sample Input: GLR Sample Output: 0

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English accountforcheating 2020-02-25 16:50:51 588 Initial revision (published)