leecode,rt_phm更新更新
This commit is contained in:
parent
30aedfc4ab
commit
93c37ea883
|
|
@ -73,7 +73,7 @@ public class T64_207_CanFinish {
|
|||
}
|
||||
|
||||
boolean valid = true;
|
||||
|
||||
//本质上就是图的深度优先搜索:检测这个图是否存在环路
|
||||
public boolean canFinish1(int numCourses, int[][] prerequisites) {
|
||||
edge = new ArrayList<>();
|
||||
for (int i = 0; i < numCourses; i++) {
|
||||
|
|
@ -95,6 +95,7 @@ public class T64_207_CanFinish {
|
|||
return valid;
|
||||
}
|
||||
|
||||
//0表示没遍历过;1表示遍历中;2表示遍历过
|
||||
public void dfs(int start, int[] visited) {
|
||||
visited[start] = 1;//设置为遍历过了
|
||||
List<Integer> childern = edge.get(start);
|
||||
|
|
|
|||
Loading…
Reference in New Issue