Question d’entretien chez Publicis Sapient

basic algorithmic question, based on dfs.