Pregunta de entrevista de Basis Worldwide

Array manipulation type question and then a leetcode easy.