1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/字母迷宫 [ju-zhen-zhong-de-lu-jing-lcof].html
2023-12-09 18:53:53 +08:00

50 lines
1.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>字母迷宫游戏初始界面记作 <code>m x n</code> 二维字符串数组 <code>grid</code>,请判断玩家是否能在 <code>grid</code> 中找到目标单词 <code>target</code><br />
注意:寻找单词时 <strong>必须</strong> 按照字母顺序,通过水平或垂直方向相邻的单元格内的字母构成,同时,同一个单元格内的字母&nbsp;<strong>不允许被重复使用&nbsp;</strong></p>
<p>&nbsp;</p>
<p><img alt="" src="https://assets.leetcode.com/uploads/2020/11/04/word2.jpg" /></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>grid = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], target = "ABCCED"
<strong>输出:</strong>true
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>grid = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], target = "SEE"
<strong>输出:</strong>true
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>grid = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], target = "ABCB"
<strong>输出:</strong>false
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>m == grid.length</code></li>
<li><code>n = grid[i].length</code></li>
<li><code>1 &lt;= m, n &lt;= 6</code></li>
<li><code>1 &lt;= target.length &lt;= 15</code></li>
<li><code>grid</code><code>target</code> 仅由大小写英文字母组成</li>
</ul>
<p>&nbsp;</p>
<p><strong>注意:</strong>本题与主站 79 题相同:<a href="https://leetcode-cn.com/problems/word-search/">https://leetcode-cn.com/problems/word-search/</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>