mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-25 06:48:57 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给出一个单词数组 <code>words</code> ,其中每个单词都由小写英文字母组成。</p>\n\n<p>如果我们可以 <strong>不改变其他字符的顺序 </strong>,在 <code>word<sub>A</sub></code> 的任何地方添加 <strong>恰好一个</strong> 字母使其变成 <code>word<sub>B</sub></code> ,那么我们认为 <code>word<sub>A</sub></code> 是 <code>word<sub>B</sub></code> 的 <strong>前身</strong> 。</p>\n\n<ul>\n\t<li>例如,<code>\"abc\"</code> 是 <code>\"abac\"</code> 的 <strong>前身</strong> ,而 <code>\"cba\"</code> 不是 <code>\"bcad\"</code> 的 <strong>前身</strong></li>\n</ul>\n\n<p><strong>词链</strong>是单词 <code>[word_1, word_2, ..., word_k]</code> 组成的序列,<code>k >= 1</code>,其中 <code>word<sub>1</sub></code> 是 <code>word<sub>2</sub></code> 的前身,<code>word<sub>2</sub></code> 是 <code>word<sub>3</sub></code> 的前身,依此类推。一个单词通常是 <code>k == 1</code> 的 <strong>单词链</strong> 。</p>\n\n<p>从给定单词列表 <code>words</code> 中选择单词组成词链,返回 词链的 <strong>最长可能长度</strong> 。<br />\n </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>words = [\"a\",\"b\",\"ba\",\"bca\",\"bda\",\"bdca\"]\n<strong>输出:</strong>4\n<strong>解释:</strong>最长单词链之一为 [\"a\",\"<u>b</u>a\",\"b<u>d</u>a\",\"bd<u>c</u>a\"]\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<b>输入:</b>words = [\"xbc\",\"pcxbcf\",\"xb\",\"cxbc\",\"pcxbc\"]\n<b>输出:</b>5\n<b>解释:</b>所有的单词都可以放入单词链 [\"xb\", \"xb<u>c</u>\", \"<u>c</u>xbc\", \"<u>p</u>cxbc\", \"pcxbc<u>f</u>\"].\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<b>输入:</b>words = [\"abcd\",\"dbqca\"]\n<strong>输出:</strong>1\n<b>解释:</b>字链[\"abcd\"]是最长的字链之一。\n[\"abcd\",\"dbqca\"]不是一个有效的单词链,因为字母的顺序被改变了。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= words.length <= 1000</code></li>\n\t<li><code>1 <= words[i].length <= 16</code></li>\n\t<li><code>words[i]</code> 仅由小写英文字母组成。</li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 167,
|
||||
"likes": 171,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -161,7 +161,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"12.5K\", \"totalSubmission\": \"26.7K\", \"totalAcceptedRaw\": 12528, \"totalSubmissionRaw\": 26658, \"acRate\": \"47.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"13K\", \"totalSubmission\": \"27.6K\", \"totalAcceptedRaw\": 12991, \"totalSubmissionRaw\": 27613, \"acRate\": \"47.0%\"}",
|
||||
"hints": [
|
||||
"Instead of adding a character, try deleting a character to form a chain in reverse.",
|
||||
"For each word in order of length, for each word2 which is word with one character removed, length[word2] = max(length[word2], length[word] + 1)."
|
||||
|
||||
Reference in New Issue
Block a user