Domanda di colloquio di Goldman Sachs

A coding question of leetcode medium difficulty