Pergunta de entrevista da empresa Salesforce

Asked me to write code on phone interview, which i wasn't expecting. Reverse of a string