Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7ade880

Browse files
docs: update description to lcof problem No.12 (#714)
面试题12. 矩阵中的路径
1 parent afe3471 commit 7ade880

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

‎lcof/面试题12. 矩阵中的路径/README.md‎

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

33
## 题目描述
44

5-
请设计一个函数,用来判断在一个矩阵中是否存在一条包含某字符串所有字符的路径。路径可以从矩阵中的任意一格开始,每一步可以在矩阵中向左、右、上、下移动一格。如果一条路径经过了矩阵的某一格,那么该路径不能再次进入该格子。例如,在下面的 ×ばつ4 的矩阵中包含一条字符串"bfce"的路径(路径中的字母用加粗标出)
5+
给定一个 `m x n` 二维字符网格 `board` 和一个字符串单词 `word`。如果 `word` 存在于网格中,返回 `true`;否则,返回 `false`
66

7-
```
8-
[["a","b","c","e"],
9-
["s","f","c","s"],
10-
["a","d","e","e"]]
11-
```
7+
单词必须按照字母顺序,通过相邻的单元格内的字母构成,其中"相邻"单元格是那些水平相邻或垂直相邻的单元格。同一个单元格内的字母不允许被重复使用。
8+
9+
10+
例如,在下面的 ×ばつ4 的矩阵中包含单词 "ABCCED"(单词中的字母已标出)。
1211

13-
但矩阵中不包含字符串"abfb"的路径,因为字符串的第一个字符 b 占据了矩阵中的第一行第二个格子之后,路径不能再次进入这个格子。
12+
![](./images/word2.jpg)
1413

1514
**示例 1:**
1615

@@ -30,6 +29,7 @@
3029

3130
- `1 <= board.length <= 200`
3231
- `1 <= board[i].length <= 200`
32+
- `board``word` 仅由大小写英文字母组成
3333

3434
## 解法
3535

12.9 KB
Loading[フレーム]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /