Microsoft Interview Question

a graph question involving dfs