Pergunta de entrevista da empresa Google

Leetcoding as usual. Nothing too difficult.