Pergunta de entrevista da empresa Givery

Graph question equivalent to leetcode hard