mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 07:21:40 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>在英语中,有一个叫做 <code>词根(root)</code> 的概念,它可以跟着其他一些词组成另一个较长的单词——我们称这个词为 <code>继承词(successor)</code>。例如,词根<code>an</code>,跟随着单词 <code>other</code>(其他),可以形成新的单词 <code>another</code>(另一个)。</p>\n\n<p>现在,给定一个由许多词根组成的词典和一个句子,需要将句子中的所有<code>继承词</code>用<code>词根</code>替换掉。如果<code>继承词</code>有许多可以形成它的<code>词根</code>,则用最短的词根替换它。</p>\n\n<p>需要输出替换之后的句子。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>dictionary = ["cat","bat","rat"], sentence = "the cattle was rattled by the battery"\n<strong>输出:</strong>"the cat was rat by the bat"\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>dictionary = ["a","b","c"], sentence = "aadsfasf absbs bbab cadsfafs"\n<strong>输出:</strong>"a a b c"\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>dictionary = ["a", "aa", "aaa", "aaaa"], sentence = "a aa a aaaa aaa aaa aaa aaaaaa bbb baba ababa"\n<strong>输出:</strong>"a a a a a a a a bbb baba a"\n</pre>\n\n<p><strong>示例 4:</strong></p>\n\n<pre>\n<strong>输入:</strong>dictionary = ["catt","cat","bat","rat"], sentence = "the cattle was rattled by the battery"\n<strong>输出:</strong>"the cat was rat by the bat"\n</pre>\n\n<p><strong>示例 5:</strong></p>\n\n<pre>\n<strong>输入:</strong>dictionary = ["ac","ab"], sentence = "it is abnormal that this solution is accepted"\n<strong>输出:</strong>"it is ab that this solution is ac"\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= dictionary.length <= 1000</code></li>\n\t<li><code>1 <= dictionary[i].length <= 100</code></li>\n\t<li><code>dictionary[i]</code> 仅由小写字母组成。</li>\n\t<li><code>1 <= sentence.length <= 10^6</code></li>\n\t<li><code>sentence</code> 仅由小写字母和空格组成。</li>\n\t<li><code>sentence</code> 中单词的总量在范围 <code>[1, 1000]</code> 内。</li>\n\t<li><code>sentence</code> 中每个单词的长度在范围 <code>[1, 1000]</code> 内。</li>\n\t<li><code>sentence</code> 中单词之间由一个空格隔开。</li>\n\t<li><code>sentence</code> 没有前导或尾随空格。</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 648 题相同: <a href=\"https://leetcode-cn.com/problems/replace-words/\">https://leetcode-cn.com/problems/replace-words/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 17,
|
||||
"likes": 20,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"6.2K\", \"totalSubmission\": \"8.7K\", \"totalAcceptedRaw\": 6233, \"totalSubmissionRaw\": 8671, \"acRate\": \"71.9%\"}",
|
||||
"stats": "{\"totalAccepted\": \"7.5K\", \"totalSubmission\": \"10.6K\", \"totalAcceptedRaw\": 7545, \"totalSubmissionRaw\": 10622, \"acRate\": \"71.0%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
Reference in New Issue
Block a user