NVIDIA Interview Question

Topologically sort a DAG and detect cycles