there total numcourse course label 0 numcourses 1 you give array prerequisite prerequisitesi ai bi indicate course bi want course aifor example pair 0 1 indicate course 0 course 1return true finish course otherwise return false Example 1input numcourses 2 prerequisite 10output trueexplanation there total 2 course to course 1 finish course 0 so possibleExample 2input numcourses 2 prerequisite 1001output falseexplanation there total 2 course to course 1 finish course 0 course 0 finish course 1 so impossible Constraints1 numcourses 20000 prerequisiteslength 5000prerequisitesilength 20 ai bi numCoursesAll pair prerequisitesi unique