unifystockx / code_compete

Coding Competition with TDD and TypeScript
MIT License
0 stars 2 forks source link

Assignment - Find the final direction facing of the vehicle at the end of the journey #17

Open krajasekhar-unify opened 4 years ago

krajasekhar-unify commented 4 years ago

Problem Statement: A Vehicle (initially facing towards NORTH) travelled according to the direction moves got from the input. Find the direction in which the vehicle is facing at the end of the journey.

List of the Directions: NORTH / EAST / WEST / SOUTH Possible moves from input: STRAIGHT / LEFT / RIGHT / BACK

Sample Input

['STRAIGHT', 'RIGHT', 'LEFT', 'BACK', 'RIGHT' , 'STRAIGHT', 'LEFT']

Sample Output SOUTH

Explanation Direction of facing after each step from the moves will go as follows

Initial facing - NORTH 'STRAIGHT' - NORTH 'RIGHT' - EAST 'LEFT' - NORTH 'BACK' - SOUTH 'RIGHT' - WEST 'STRAIGHT' - WEST 'LEFT' - SOUTH

Rules

krajasekhar-unify commented 3 years ago

Let's not close the issue until all the linked pull requests are merged.