You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Input: numCourses = 2, prerequisites = [[1,0]]
Output: true
Explanation: There are a total of 2 courses to take.
To take course 1 you should have finished course 0. So it is possible.
Example 2
Input: numCourses = 2, prerequisites = [[1,0],[0,1]]
Output: false
Explanation: There are a total of 2 courses to take.
To take course 1 you should have finished course 0, and to take course 0 you should
also have finished course 1. So it is impossible.
Note:
输入的先决条件是由 边缘列表 表示的图形,而不是 邻接矩阵 。
你可以假定输入的先决条件中没有重复的边。
1 <= numCourses <= 10^5
The text was updated successfully, but these errors were encountered:
207. Course Schedule
你这个学期必须选修
numCourse
门课程,记为0
到numCourse-1
。在选修某些课程之前需要一些先修课程。 例如,想要学习课程
0
,你需要先完成课程1
,我们用一个匹配来表示他们:[0,1]
给定课程总量以及它们的先决条件,请你判断是否可能完成所有课程的学习?
Example 1
Example 2
Note:
1 <= numCourses <= 10^5
The text was updated successfully, but these errors were encountered: