Pergunta de entrevista da empresa SmartNews

First round leetcode medium question about graphs