Pergunta de entrevista da empresa TeamViewer

I was asked to reverse a String