Domanda di colloquio di Goldman Sachs

leetcode style question, medium-hard, regarding arrays.