mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-22 21:46:46 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个字符串 <code>s</code>,请你对 <code>s</code> 的子串进行检测。</p>\n\n<p>每次检测,待检子串都可以表示为 <code>queries[i] = [left, right, k]</code>。我们可以 <strong>重新排列</strong> 子串 <code>s[left], ..., s[right]</code>,并从中选择 <strong>最多</strong> <code>k</code> 项替换成任何小写英文字母。 </p>\n\n<p>如果在上述检测过程中,子串可以变成回文形式的字符串,那么检测结果为 <code>true</code>,否则结果为 <code>false</code>。</p>\n\n<p>返回答案数组 <code>answer[]</code>,其中 <code>answer[i]</code> 是第 <code>i</code> 个待检子串 <code>queries[i]</code> 的检测结果。</p>\n\n<p>注意:在替换时,子串中的每个字母都必须作为 <strong>独立的</strong> 项进行计数,也就是说,如果 <code>s[left..right] = "aaa"</code> 且 <code>k = 2</code>,我们只能替换其中的两个字母。(另外,任何检测都不会修改原始字符串 <code>s</code>,可以认为每次检测都是独立的)</p>\n\n<p> </p>\n\n<p><strong>示例:</strong></p>\n\n<pre><strong>输入:</strong>s = "abcda", queries = [[3,3,0],[1,2,0],[0,3,1],[0,3,2],[0,4,1]]\n<strong>输出:</strong>[true,false,false,true,true]\n<strong>解释:</strong>\nqueries[0] : 子串 = "d",回文。\nqueries[1] : 子串 = "bc",不是回文。\nqueries[2] : 子串 = "abcd",只替换 1 个字符是变不成回文串的。\nqueries[3] : 子串 = "abcd",可以变成回文的 "abba"。 也可以变成 "baab",先重新排序变成 "bacd",然后把 "cd" 替换为 "ab"。\nqueries[4] : 子串 = "abcda",可以变成回文的 "abcba"。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= s.length, queries.length <= 10^5</code></li>\n\t<li><code>0 <= queries[i][0] <= queries[i][1] < s.length</code></li>\n\t<li><code>0 <= queries[i][2] <= s.length</code></li>\n\t<li><code>s</code> 中只有小写英文字母</li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 58,
|
||||
"likes": 60,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"6.8K\", \"totalSubmission\": \"24.6K\", \"totalAcceptedRaw\": 6763, \"totalSubmissionRaw\": 24578, \"acRate\": \"27.5%\"}",
|
||||
"stats": "{\"totalAccepted\": \"6.9K\", \"totalSubmission\": \"24.9K\", \"totalAcceptedRaw\": 6889, \"totalSubmissionRaw\": 24885, \"acRate\": \"27.7%\"}",
|
||||
"hints": [
|
||||
"Since we can rearrange the substring, all we care about is the frequency of each character in that substring.",
|
||||
"How to find the character frequencies efficiently ?",
|
||||
|
Reference in New Issue
Block a user