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>word</code> 和一个整数 <code>k</code> 。</p>\n\n<p>如果 <code>word</code> 的一个子字符串 <code>s</code> 满足以下条件,我们称它是 <strong>完全字符串:</strong></p>\n\n<ul>\n\t<li><code>s</code> 中每个字符 <strong>恰好</strong> 出现 <code>k</code> 次。</li>\n\t<li>相邻字符在字母表中的顺序 <strong>至多</strong> 相差 <code>2</code> 。也就是说,<code>s</code> 中两个相邻字符 <code>c1</code> 和 <code>c2</code> ,它们在字母表中的位置相差<strong> 至多</strong> 为 <code>2</code> 。</li>\n</ul>\n\n<p>请你返回 <code>word</code> 中 <strong>完全</strong> 子字符串的数目。</p>\n\n<p><strong>子字符串</strong> 指的是一个字符串中一段连续 <strong>非空</strong> 的字符序列。</p>\n\n<p> </p>\n\n<p><strong class=\"example\">示例 1:</strong></p>\n\n<pre>\n<b>输入:</b>word = \"igigee\", k = 2\n<b>输出:</b>3\n<b>解释:</b>完全子字符串需要满足每个字符恰好出现 2 次,且相邻字符相差至多为 2 :<em><strong>igig</strong></em>ee, igig<strong style=\"font-style: italic;\">ee</strong>, <em><strong>igigee</strong> 。</em>\n</pre>\n\n<p><strong class=\"example\">示例 2:</strong></p>\n\n<pre>\n<b>输入:</b>word = \"aaabbbccc\", k = 3\n<b>输出:</b>6\n<b>解释:</b>完全子字符串需要满足每个字符恰好出现 3 次,且相邻字符相差至多为 2 :<em><strong>aaa</strong></em>bbbccc, aaa<em><strong>bbb</strong></em>ccc, aaabbb<em><strong>ccc</strong></em>, <em><strong>aaabbb</strong></em>ccc, aaa<em><strong>bbbccc</strong></em>, <em><strong>aaabbbccc </strong></em>。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= word.length <= 10<sup>5</sup></code></li>\n\t<li><code>word</code> 只包含小写英文字母。</li>\n\t<li><code>1 <= k <= word.length</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 24,
|
||||
"likes": 26,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"2.9K\", \"totalSubmission\": \"9K\", \"totalAcceptedRaw\": 2917, \"totalSubmissionRaw\": 9026, \"acRate\": \"32.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"2.9K\", \"totalSubmission\": \"9.1K\", \"totalAcceptedRaw\": 2943, \"totalSubmissionRaw\": 9095, \"acRate\": \"32.4%\"}",
|
||||
"hints": [
|
||||
"There are at most 26 different lengths of the complete substrings: <code>k *1, k * 2, … k * 26</code>.****",
|
||||
"For each length, we can use sliding window to count the frequency of each letter in the window.",
|
||||
|
Reference in New Issue
Block a user