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 21:30
How do you take a green screen out of the video while editing?
Answers: 2
question
Computers and Technology, 24.06.2019 02:40
Has anyone seen my grandma shes been gone for 4 years already
Answers: 1
question
Computers and Technology, 24.06.2019 03:00
What is one potential problem associated with an organization purchasing new technology early in its lifecycle
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
How are roger williams, james oglethorpe, and william penn similar?
Answers: 3
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
Mathematics, 12.09.2019 02:30
question
Mathematics, 12.09.2019 02:30