6sense Interview Question

DFS, Trees