Altus Group interview question

Write code on whiteboard to reverse a string