Question d’entretien chez Amazon

One coding question based on DFS