Question d’entretien chez Oracle

cyclic graph question from leetcode