Interview Question for Software Engineers
- -1of 1 vote
You are given a series of moves as a string, such as ">^V<^". You need to output a list with all the series of moves that represent a loop if they were made by a robot for example.- Ray February 01, 2017 in United States
A loop is defined as a series of moves that lead to the same position, for example "><" or "^V".
In the case of "^>V<^" the output should be ["^>V<", "^>V<"], essentially the last move generates a new loop because it leads to a position that was visited before and that naturally can be followed up to the same position and describe a loop.
| Report Duplicate | Flag | PURGE
Software Engineer Algorithm