Airbnb Interview Question

1 graph question (topological sort)