A rover is given instructions such as Move (M), Left (L) and Right (R). Check if given set of moves is circular or not. If circular return
true, otherwise return
false. The move is circular if its starting and ending coordinates are the same. The moves contain instructions to move one unit in same direction (M), to change direction to left of current direction (L) and to change direction to right of current direction (R).
Imagine the rover given the set of moves
MRMRMRM. The robot will execute the orders in sequence:
After the last instruction, the robot will arrive at the original position. So the program should return