From 93c37ea883ca92cac6267f9d08b977128c1b6261 Mon Sep 17 00:00:00 2001 From: markilue <745518019@qq.com> Date: Mon, 22 May 2023 14:17:47 +0800 Subject: [PATCH] =?UTF-8?q?leecode=EF=BC=8Crt=5Fphm=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/markilue/leecode/hot100/second/T64_207_CanFinish.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Leecode/src/main/java/com/markilue/leecode/hot100/second/T64_207_CanFinish.java b/Leecode/src/main/java/com/markilue/leecode/hot100/second/T64_207_CanFinish.java index 68aa13f..d1ad5f9 100644 --- a/Leecode/src/main/java/com/markilue/leecode/hot100/second/T64_207_CanFinish.java +++ b/Leecode/src/main/java/com/markilue/leecode/hot100/second/T64_207_CanFinish.java @@ -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 childern = edge.get(start);