Pregunta de entrevista de Morgan Stanley

Asked me array manipulation coding question,