Flatiron Health Interview Question

typical DFS applied on trees, DAG, and graph