Pregunta de entrevista de Goldman Sachs

A coding question of leetcode medium difficulty