Pergunta de entrevista da empresa Google Cloud

Graph questions a hard one from leetcode.