Question d’entretien chez Amazon

Coding question of tree and graph