Question d’entretien chez Amazon

Graph Question - convert the graph to a tree (medium)