Pergunta de entrevista da empresa Amazon

The coding question I was asked was similar to the Course Scheduler problem in leetcode which is based on Topological Sort Algorithm on directed graphs