Блог пользователя accountforcheating

Автор accountforcheating, история, 4 года назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • -22
  • Проголосовать: не нравится