Question d’entretien chez Amazon

Question related to graphs, leetcode medium