【leetcode每日刷题】210. Course Schedule II

https://leetcode.com/problems/course-schedule-ii/

import java.util.LinkedList;

class Solution {
    public int[] findOrder(int numCourses, int[][] prerequisites) {
        int[][] matrix = new int[numCourses][numCourses];
        int[] indegree = new int[numCourses];
        for(int[] item:prerequisites){
            int start = item[0];
            int end = item[1];
            matrix[end][start] += 1;
            indegree[start] += 1;
        }
        LinkedList queue = new LinkedList();
        for(int i=0; i

 

你可能感兴趣的:(leetcode刷题,java)