1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-02 22:13:28 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>设计一个使用单词列表进行初始化的数据结构,单词列表中的单词 <strong>互不相同</strong> 。 如果给出一个单词,请判定能否只将这个单词中<strong>一个</strong>字母换成另一个字母,使得所形成的新单词存在于已构建的神奇字典中。</p>\n\n<p>实现 <code>MagicDictionary</code> 类:</p>\n\n<ul>\n\t<li><code>MagicDictionary()</code> 初始化对象</li>\n\t<li><code>void buildDict(String[]&nbsp;dictionary)</code> 使用字符串数组&nbsp;<code>dictionary</code> 设定该数据结构,<code>dictionary</code> 中的字符串互不相同</li>\n\t<li><code>bool search(String searchWord)</code> 给定一个字符串 <code>searchWord</code> ,判定能否只将字符串中<strong> 一个 </strong>字母换成另一个字母,使得所形成的新字符串能够与字典中的任一字符串匹配。如果可以,返回 <code>true</code> ;否则,返回 <code>false</code> 。</li>\n</ul>\n\n<p>&nbsp;</p>\n\n<div class=\"top-view__1vxA\">\n<div class=\"original__bRMd\">\n<div>\n<p><strong>示例:</strong></p>\n\n<pre>\n<strong>输入</strong>\ninputs = [&quot;MagicDictionary&quot;, &quot;buildDict&quot;, &quot;search&quot;, &quot;search&quot;, &quot;search&quot;, &quot;search&quot;]\ninputs = [[], [[&quot;hello&quot;, &quot;leetcode&quot;]], [&quot;hello&quot;], [&quot;hhllo&quot;], [&quot;hell&quot;], [&quot;leetcoded&quot;]]\n<strong>输出</strong>\n[null, null, false, true, false, false]\n\n<strong>解释</strong>\nMagicDictionary magicDictionary = new MagicDictionary();\nmagicDictionary.buildDict([&quot;hello&quot;, &quot;leetcode&quot;]);\nmagicDictionary.search(&quot;hello&quot;); // 返回 False\nmagicDictionary.search(&quot;hhllo&quot;); // 将第二个 &#39;h&#39; 替换为 &#39;e&#39; 可以匹配 &quot;hello&quot; ,所以返回 True\nmagicDictionary.search(&quot;hell&quot;); // 返回 False\nmagicDictionary.search(&quot;leetcoded&quot;); // 返回 False\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;=&nbsp;dictionary.length &lt;= 100</code></li>\n\t<li><code>1 &lt;=&nbsp;dictionary[i].length &lt;= 100</code></li>\n\t<li><code>dictionary[i]</code> 仅由小写英文字母组成</li>\n\t<li><code>dictionary</code> 中的所有字符串 <strong>互不相同</strong></li>\n\t<li><code>1 &lt;=&nbsp;searchWord.length &lt;= 100</code></li>\n\t<li><code>searchWord</code> 仅由小写英文字母组成</li>\n\t<li><code>buildDict</code> 仅在 <code>search</code> 之前调用一次</li>\n\t<li>最多调用 <code>100</code> 次 <code>search</code></li>\n</ul>\n</div>\n</div>\n</div>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 676&nbsp;题相同:&nbsp;<a href=\"https://leetcode-cn.com/problems/implement-magic-dictionary/\">https://leetcode-cn.com/problems/implement-magic-dictionary/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 17,
"likes": 19,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"5.2K\", \"totalSubmission\": \"8.4K\", \"totalAcceptedRaw\": 5168, \"totalSubmissionRaw\": 8408, \"acRate\": \"61.5%\"}",
"stats": "{\"totalAccepted\": \"6.3K\", \"totalSubmission\": \"10.3K\", \"totalAcceptedRaw\": 6322, \"totalSubmissionRaw\": 10316, \"acRate\": \"61.3%\"}",
"hints": [],
"solution": null,
"status": null,