Question d’entretien chez Goldman Sachs

leetcode style question, medium-hard, regarding arrays.