Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A drawing robot is positioned at point ( 0 , 0 ) of a coordinate plane, and the string moves describes the path the robot
A drawing robot is positioned at point of a coordinate plane, and the string moves describes the path the robot will take.
Each of the strings's characters describes a single move made by the robot. Moreover, the robot will make the moves in the exact same order as they appear in the string, starting from position
Assuming the robot has already made some moves from the string, and is currently at point x y if the next character of the string is:
: the robot will move to x y ;
v: the robot will move to x y ;
: the robot will move to x y;
: the robot will move to x y
Each time the robot moves, it draws a line between its current position and the point to which it moves.
It is guaranteed that the instructions provided in the string moves will never cause the robot to visit the same point more than once, with the exception of point which might be visited by the robot exactly twice: at the beginning and at the end of the robot's path.
The task is to determine whether, after the robot has made all moves provided in the string, all the lines it has drawn form a single rectangle.
Write a function:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started