Publicis Sapient interview question

Coding test similar to robot return to origin