#330 Checking Whether the Manipulator Returns to the Starting Point

Companies:
Nsis
Themes:
AlgorithmsStringsPractice

A manipulator starts at its initial point and can move:

  • forward
  • backward
  • right
  • left
    • The manipulator receives a random string containing one-character command tokens. It processes the tokens sequentially and executes the corresponding commands. After processing all tokens, the manipulator stops.

      The manipulator supports four token types: U, D, R, and L, corresponding to movement directions. The tokens are not separated inside the string.

      Write a function that accepts a token string and determines whether the manipulator is at its starting point after stopping:

      UURLLLRUDDRD...

Question review

Mentor
Answer as you would in a real interview. I’ll ask follow-up questions, then compare your answer with the reference answer and show your accuracy as a %.
Sign in to start the dialogue The mentor keeps the context of the current question and your previous messages.
Sign in