Netflix Interview Question

Question related to topological sort