Altus Group Interview Question

Write code on whiteboard to reverse a string