Meta Interview Question

DFS implementation