It's a interview problem, i was told to solve the problem Mars Rover.
The rover runs in a plane. As from (0,0) to (5,5).
The rover could proceed 3 movement which are Turn Left, Turn Right, and Move Forward.
The input of the program is a coordinate in the plane such as (1,1) and a sequence of the movement such as LMRMLMLM (L/R means turn left/right, M means move),
the output is the result coordinate of the rover in the end.
What I already done is I program the rover as a object, it has some method like turn left/right and move, and some attribute like the coordinate of the rover. And the whole map is also as a object.
BUT, the technical HR told me that is not good enough to express the OOP, SO, what I want to know is what can I should do in this small program test?
Thanks everyone in this Questions.
No comments:
Post a Comment