• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
September 21, 2022 |5.6K Views
Check if a given sequence of moves for a robot is circular or not
  Share  1 Like
Description
Discussion

Given a sequence of moves for a robot, check if the sequence is circular or not. A sequence of moves is circular if first and last positions of robot are same. A move can be on of the following.

 G - Go one unit
 L - Turn left
 R - Turn right 
Examples:

Input: path[] = "GLGLGLG"
Output: Given sequence of moves is circular

Input: path[] = "GLLG"
Output: Given sequence of moves is circular

Check if a given sequence of moves for a robot is circular or not : https://www.geeksforgeeks.org/check-if-a-given-sequence-of-moves-for-a-robot-is-circular-or-not/

Read More