课程表
解题思路:拓扑排序(实际上就是贪心算法)
class Solution { public boolean canFinish(int numCourses, int[][] prerequisites) { int len = prerequisites.length; if(len==0){ return true; } int[] degree = new int[numCourses]; for(int[] p : prerequisites){ degree[p[0]]++; } LinkedListlist = new LinkedList<>(); List res = new ArrayList<>(); for(int i=0;i