Pregunta de entrevista de Indeed

Asked me to code an array question.