From 987bad6d74d57b065ae5aaf55196a0f790aa5d2c Mon Sep 17 00:00:00 2001 From: StriveDD Date: Thu, 2 Mar 2023 14:50:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A00127.=E5=8D=95=E8=AF=8D?= =?UTF-8?q?=E6=8E=A5=E9=BE=99=E7=9A=84Java=E7=89=88=E6=9C=AC=E5=8F=8C?= =?UTF-8?q?=E5=90=91BFS=E4=BB=A3=E7=A0=81=EF=BC=8C0827.=E6=9C=80=E5=A4=A7?= =?UTF-8?q?=E4=BA=BA=E5=B7=A5=E5=B2=9B=E7=9A=84Java=E7=89=88=E6=9C=AC?= =?UTF-8?q?=EF=BC=8C0841.=E9=92=A5=E5=8C=99=E5=92=8C=E6=88=BF=E9=97=B4?= =?UTF-8?q?=E7=9A=84Java=E7=89=88=E6=9C=AC=E7=9A=84BFS=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0127.单词接龙.md | 3 +-- problems/0841.钥匙和房间.md | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/problems/0127.单词接龙.md b/problems/0127.单词接龙.md index b4078913..20ad5182 100644 --- a/problems/0127.单词接龙.md +++ b/problems/0127.单词接龙.md @@ -134,9 +134,8 @@ public int ladderLength(String beginWord, String endWord, List wordList) } ``` -## Java 双向BFS - ```java +// Java 双向BFS class Solution { // 判断单词之间是否之差了一个字母 public boolean isValid(String currentWord, String chooseWord) { diff --git a/problems/0841.钥匙和房间.md b/problems/0841.钥匙和房间.md index 00263cac..faf2b97f 100644 --- a/problems/0841.钥匙和房间.md +++ b/problems/0841.钥匙和房间.md @@ -273,7 +273,9 @@ class Solution { return true; } } +``` +```Java // 广度优先搜索 class Solution { public boolean canVisitAllRooms(List> rooms) { @@ -294,7 +296,9 @@ class Solution { return true; } } +``` +```java // 广度优先遍历(时间优化) class Solution { public boolean canVisitAllRooms(List> rooms) { @@ -459,4 +463,3 @@ function canVisitAllRooms(rooms: number[][]): boolean { -