Amazon Interview Question

Find circular dependency in a dependency tree. Writing on the white board