Help in this topological sort problem
Can any one help in this problem.I tried to solve it by finding in degree edges but getting WA problem link: Uva-10305 my solution : here