Yahoo Interview Question

topological sorting