Google Interview Question

Graph problem. Involving to do a topological sort.