Pregunta de entrevista de Nagarro

Javascript arrays and a problem to solve a array coding question.