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, 22.06.2019 12:30
What characteristic of long period comets suggest they come directly from the oort cloud?
Answers: 2
question
Computers and Technology, 22.06.2019 20:00
The blank button automatically displays next to the data when you select a range of numeric data which is an available option for creating a chart
Answers: 3
question
Computers and Technology, 22.06.2019 23:30
Define a function printfeetinchshort, with int parameters numfeet and numinches, that prints using ' and " shorthand. ex: printfeetinchshort(5, 8) prints: 5' 8"
Answers: 1
question
Computers and Technology, 23.06.2019 04:31
Cloud computing service providers manage different computing resources based on the services they offer. which resources do iaas and paas providers not manage? iaas providers do not manage the for the client, whereas paas providers usually do not manage the for their clients. iaas- storage server operating system network paas- applications interafce storage vertualiation
Answers: 2
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
Biology, 29.07.2019 02:40
question
Mathematics, 29.07.2019 02:40
question
Social Studies, 29.07.2019 02:40
Questions on the website: 13722359