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 order course finish course if valid answer return if impossible finish course return array Example 1input numcourses 2 prerequisite 10output 01Explanation there total 2 course to course 1 finish course 0 so correct course order 01Example 2input numcourses 4 prerequisite 10203132output 0213explanation there total 4 course to course 3 finish course 1 2 both course 1 2 take finished course 0So correct course order 0123 another correct order 0213example 3input numcourses 1 prerequisite output 0 Constraints1 numcourses 20000 prerequisiteslength numcourses numcourses 1prerequisitesilength 20 ai bi numCoursesai biAll pair ai bi distinct