Circular Move Problem Statement
You have a robot currently positioned at the origin (0, 0) on a two-dimensional grid, facing the north direction. You are given a sequence of moves in the form of a string of length 'N'. Determine whether the robot's movement path is circular, meaning the robot ends up at the starting position.
Example:
Input:
T = 2
Test case 1: 'GLGLGLG'
Test case 2: 'GLGR'
Output:
True
False
Explanation:
A move sequence is circular if the robot returns to the starting point.
Constraints:
1 ≤ T ≤ 100
0 ≤ N ≤ 10^4
- The sequence will only consist of characters:
'L', 'R', 'G'
.

AnswerBot
4mo
Determine if a robot's movement path is circular on a 2D grid based on a given sequence of moves.
Iterate through the sequence of moves and keep track of the robot's position and direction.
Check if the...read more
Help your peers!
Add answer anonymously...
American Express Full Stack Developer interview questions & answers
A Full Stack Developer was asked Q. Buy and Sell Stock Problem Statement Imagine you are Harshad Mehta's friend, and...read more
A Full Stack Developer was asked Q. Reach the Destination Problem Statement You are given a source point (sx, sy) an...read more
A Full Stack Developer was asked Q. Circular Move Problem Statement You have a robot currently positioned at the ori...read more
Popular interview questions of Full Stack Developer
A Full Stack Developer was asked Q1. Buy and Sell Stock Problem Statement Imagine you are Harshad Mehta's friend, and...read more
A Full Stack Developer was asked Q2. Reach the Destination Problem Statement You are given a source point (sx, sy) an...read more
A Full Stack Developer was asked Q3. Circular Move Problem Statement You have a robot currently positioned at the ori...read more
>
American Express Full Stack Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

