Disney+ Hotstar interview question

https://leetcode.com/problems/course-schedule-ii/ simple topological sort solution