mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-22 13:36:46 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个下标从 <strong>0</strong> 开始的字符串 <code>s</code> 。另给你一个下标从 <strong>0</strong> 开始、长度为 <code>k</code> 的字符串 <code>queryCharacters</code> ,一个下标从 <code>0</code> 开始、长度也是 <code>k</code> 的整数 <strong>下标</strong> 数组 <code>queryIndices</code> ,这两个都用来描述 <code>k</code> 个查询。</p>\n\n<p>第 <code>i</code> 个查询会将 <code>s</code> 中位于下标 <code>queryIndices[i]</code> 的字符更新为 <code>queryCharacters[i]</code> 。</p>\n\n<p>返回一个长度为 <code>k</code> 的数组 <code>lengths</code> ,其中 <code>lengths[i]</code> 是在执行第 <code>i</code> 个查询 <strong>之后</strong> <code>s</code> 中仅由 <strong>单个字符重复</strong> 组成的 <strong>最长子字符串</strong> 的 <strong>长度</strong> <em>。</em></p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"babacc\", queryCharacters = \"bcb\", queryIndices = [1,3,3]\n<strong>输出:</strong>[3,3,4]\n<strong>解释:</strong>\n- 第 1 次查询更新后 s = \"<em>b<strong>b</strong>b</em>acc\" 。由单个字符重复组成的最长子字符串是 \"bbb\" ,长度为 3 。\n- 第 2 次查询更新后 s = \"bbb<em><strong>c</strong>cc</em>\" 。由单个字符重复组成的最长子字符串是 \"bbb\" 或 \"ccc\",长度为 3 。\n- 第 3 次查询更新后 s = \"<em>bbb<strong>b</strong></em>cc\" 。由单个字符重复组成的最长子字符串是 \"bbbb\" ,长度为 4 。\n因此,返回 [3,3,4] 。</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"abyzz\", queryCharacters = \"aa\", queryIndices = [2,1]\n<strong>输出:</strong>[2,3]\n<strong>解释:</strong>\n- 第 1 次查询更新后 s = \"ab<strong>a</strong><em>zz</em>\" 。由单个字符重复组成的最长子字符串是 \"zz\" ,长度为 2 。\n- 第 2 次查询更新后 s = \"<em>a<strong>a</strong>a</em>zz\" 。由单个字符重复组成的最长子字符串是 \"aaa\" ,长度为 3 。\n因此,返回 [2,3] 。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= s.length <= 10<sup>5</sup></code></li>\n\t<li><code>s</code> 由小写英文字母组成</li>\n\t<li><code>k == queryCharacters.length == queryIndices.length</code></li>\n\t<li><code>1 <= k <= 10<sup>5</sup></code></li>\n\t<li><code>queryCharacters</code> 由小写英文字母组成</li>\n\t<li><code>0 <= queryIndices[i] < s.length</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 15,
|
||||
"likes": 18,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"1.7K\", \"totalSubmission\": \"4.8K\", \"totalAcceptedRaw\": 1691, \"totalSubmissionRaw\": 4834, \"acRate\": \"35.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"2K\", \"totalSubmission\": \"5.5K\", \"totalAcceptedRaw\": 1972, \"totalSubmissionRaw\": 5499, \"acRate\": \"35.9%\"}",
|
||||
"hints": [
|
||||
"Use a segment tree to perform fast point updates and range queries.",
|
||||
"We need each segment tree node to store the length of the longest substring of that segment consisting of only 1 repeating character.",
|
||||
|
Reference in New Issue
Block a user