Pergunta de entrevista da empresa Google

Leetcode Medium - Hard question with multiple followups