1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-05 07:21:40 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2023-12-09 19:57:46 +08:00
parent 9bc4722a45
commit 3770b44d1e
4792 changed files with 10889 additions and 10886 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个字符串&nbsp;<code>word</code>&nbsp;和一个整数 <code>k</code>&nbsp;。</p>\n\n<p>如果&nbsp;<code>word</code>&nbsp;的一个子字符串 <code>s</code>&nbsp;满足以下条件,我们称它是 <strong>完全字符串:</strong></p>\n\n<ul>\n\t<li><code>s</code>&nbsp;中每个字符 <strong>恰好</strong>&nbsp;出现 <code>k</code>&nbsp;次。</li>\n\t<li>相邻字符在字母表中的顺序 <strong>至多</strong>&nbsp;相差&nbsp;<code>2</code>&nbsp;。也就是说,<code>s</code>&nbsp;中两个相邻字符&nbsp;<code>c1</code> 和&nbsp;<code>c2</code>&nbsp;,它们在字母表中的位置相差<strong>&nbsp;至多</strong>&nbsp;为 <code>2</code> 。</li>\n</ul>\n\n<p>请你返回 <code>word</code>&nbsp;中 <strong>完全</strong>&nbsp;子字符串的数目。</p>\n\n<p><strong>子字符串</strong>&nbsp;指的是一个字符串中一段连续 <strong>非空</strong>&nbsp;的字符序列。</p>\n\n<p>&nbsp;</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>&nbsp;。</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>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= word.length &lt;= 10<sup>5</sup></code></li>\n\t<li><code>word</code>&nbsp;只包含小写英文字母。</li>\n\t<li><code>1 &lt;= k &lt;= 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.",