Pergunta de entrevista da empresa Meta

Leet code average difficulty problem