Pregunta de entrevista de Atlassian

graph based question, to be solved using dfs