Pregunta de entrevista de Bank of America

How to reverse an array?