Moveo Group interview question

coding task - to do loop machine