Pergunta de entrevista da empresa Rica Tech

What is the logic to reverse the array