Bloomberg interview question

LeetCode medium - DFS through a graph