subject

Given a robot which can only move in four directions, UP(U), DOWN(D), LEFT(L), RIGHT(R). Given a string consisting of instructions to move. Output the coordinates of a robot after executing the instructions. Initial position of robot is at origin(0, 0).

Examples:

Input : move = "UDDLRL"
Output : (-1, -1)
Move U : (0, 0)--(0, 1)
Move D : (0, 1)--(0, 0)
Move D : (0, 0)--(0, -1)
Move L : (0, -1)--(-1, -1)
Move R : (-1, -1)--(0, -1)
Move L : (0, -1)--(-1, -1)

Therefore final position after the complete
movement is: (-1, -1)

Input : move = ""
Output : (2, 3)

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 23:00
The animal classthis class represents a an animal residing at a zoo. it has a weight (in pounds),height (in inches), a name, and a color. the methods in the class include constructors,getters, and a tostring. you will finish the implementation of these methods. referto the code documentation.1.getters: you will need to implement getter methods. these get a value (froma member variable) in the animal class. you will make a getter method toreturn each variable (weight, height, name, color). reference getname if youare having issues.2.tostring: you will need to finish the tostring method. this returns a stringcontaining information about an animal. the output string should be of theformat: ” (name) , a ( color )â’colored animal . ( weight ) pounds , ( height ) inches .\n”the height and weight are formatted to 1 decimal place. recall from lab 1how to format strings neatly using string. see the reference sectionfor more about string.format.
Answers: 2
question
Computers and Technology, 22.06.2019 11:10
Which are not examples of chronic or persistent stress? moving
Answers: 1
question
Computers and Technology, 22.06.2019 14:30
Create a pseudocode design to prompt a student for their student id and the titles of the three classes they want to add. the solution should display the student’s id and a total bill. • bill a student using the following rules: o students can only add up to 3 classes at a time.
Answers: 3
question
Computers and Technology, 23.06.2019 22:30
The output voltage of a power supply is assumed to be normally distributed. sixteen observations are taken at random on voltage are as follows: 10.35, 9.30, 10.00, 9.96, 11.65, 12.00, 11.25, 9.58, 11.54, 9.95, 10.28, 8.37, 10.44, 9.25, 9.38, and 10.85
Answers: 1
You know the right answer?
Given a robot which can only move in four directions, UP(U), DOWN(D), LEFT(L), RIGHT(R). Given a str...
Questions
question
English, 22.05.2020 20:02
question
Mathematics, 22.05.2020 20:02
question
Mathematics, 22.05.2020 20:02
Questions on the website: 13722367