Pergunta de entrevista da empresa Goldman Sachs

A coding question of leetcode medium difficulty