Skip to content

Commit 724b22d

Browse files
committed
✨style: Bulk processing format
1 parent 798a665 commit 724b22d

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

LeetCode/121-130/127. 单词接龙(困难).md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
这是 LeetCode 上的 **[127. 单词接龙](https://leetcode-cn.com/problems/word-ladder/solution/gong-shui-san-xie-ru-he-shi-yong-shuang-magjd/)** ,难度为 **困难**
44

5-
Tag : 「双向 BFS」
5+
Tag : 「双向 BFS」、「启发式搜索」、「AStar 算法」
66

77

88

@@ -19,24 +19,28 @@ Tag : 「双向 BFS」
1919
示例 1:
2020
```
2121
输入:beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log","cog"]
22+
2223
输出:5
24+
2325
解释:一个最短转换序列是 "hit" -> "hot" -> "dot" -> "dog" -> "cog", 返回它的长度 5。
2426
```
2527
示例 2:
2628
```
2729
输入:beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log"]
30+
2831
输出:0
32+
2933
解释:endWord "cog" 不在字典中,所以无法进行转换。
3034
```
3135

3236
提示:
33-
* 1 <= beginWord.length <= 10
34-
* endWord.length == beginWord.length
35-
* 1 <= wordList.length <= 5000
36-
* wordList[i].length == beginWord.length
37-
* beginWordendWord 和 wordList[i] 由小写英文字母组成
38-
* beginWord != endWord
39-
* wordList 中的所有字符串 互不相同
37+
* $1 <= beginWord.length <= 10$
38+
* $endWord.length == beginWord.length$
39+
* $1 <= wordList.length <= 5000$
40+
* $wordList[i].length == beginWord.length$
41+
* `beginWord``endWord``wordList[i]` 由小写英文字母组成
42+
* `beginWord != endWord`
43+
* `wordList` 中的所有字符串 互不相同
4044

4145
---
4246

@@ -200,8 +204,8 @@ class Solution {
200204
}
201205
}
202206
```
203-
* 时间复杂度:令 `wordList` 长度为 $n$,`beginWord` 字符串长度为 $m$。由于所有的搜索结果必须都在 `wordList` 出现过,因此算上起点最多有 $n + 1$ 节点,最坏情况下,所有节点都联通,搜索完整张图复杂度为 $O(n^2)$ ;从 `beginWord` 出发进行字符替换,替换时进行逐字符检查,复杂度为 $O(m)$。整体复杂度为 $O(m * n^2)$
204-
* 空间复杂度:同等空间大小。$O(m * n^2)$
207+
* 时间复杂度:令 `wordList` 长度为 $n$,`beginWord` 字符串长度为 $m$。由于所有的搜索结果必须都在 `wordList` 出现过,因此算上起点最多有 $n + 1$ 节点,最坏情况下,所有节点都联通,搜索完整张图复杂度为 $O(n^2)$ ;从 `beginWord` 出发进行字符替换,替换时进行逐字符检查,复杂度为 $O(m)$。整体复杂度为 $O(m \times n^2)$
208+
* 空间复杂度:同等空间大小。$O(m \times n^2)$
205209

206210
---
207211

@@ -285,6 +289,8 @@ class Solution {
285289
}
286290
}
287291
```
292+
* 时间复杂度:启发式搜索分析时空复杂度意义不大
293+
* 空间复杂度:启发式搜索分析时空复杂度意义不大
288294

289295
---
290296

LeetCode/431-440/433. 最小基因变化(中等).md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
这是 LeetCode 上的 **[433. 最小基因变化](https://leetcode-cn.com/problems/minimum-genetic-mutation/solution/by-ac_oier-74b4/)** ,难度为 **中等**
44

5-
Tag : 「BFS」、「双向 BFS」、「图论 DFS」、「A* 算法」、「启发式搜索」
5+
Tag : 「BFS」、「双向 BFS」、「图论 DFS」、「AStar 算法」、「启发式搜索」
66

77

88

0 commit comments

Comments
 (0)