1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-07 00:11:41 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给你两个长度相同的字符串,<code>s</code> 和 <code>t</code>。</p>\n\n<p>将 <code>s</code> 中的第 <code>i</code> 个字符变到 <code>t</code> 中的第 <code>i</code> 个字符需要 <code>|s[i] - t[i]|</code> 的开销(开销可能为 0也就是两个字符的 ASCII 码值的差的绝对值。</p>\n\n<p>用于变更字符串的最大预算是 <code>maxCost</code>。在转化字符串时,总开销应当小于等于该预算,这也意味着字符串的转化可能是不完全的。</p>\n\n<p>如果你可以将 <code>s</code> 的子字符串转化为它在 <code>t</code> 中对应的子字符串,则返回可以转化的最大长度。</p>\n\n<p>如果 <code>s</code> 中没有子字符串可以转化成 <code>t</code> 中对应的子字符串,则返回 <code>0</code>。</p>\n\n<p> </p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"abcd\", t = \"bcdf\", maxCost = 3\n<strong>输出:</strong>3\n<strong>解释:</strong>s<strong> </strong>中的<strong> </strong>\"abc\" 可以变为 \"bcd\"。开销为 3所以最大长度为 3。</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"abcd\", t = \"cdef\", maxCost = 3\n<strong>输出:</strong>1\n<strong>解释:</strong>s 中的任一字符要想变成 t 中对应的字符,其开销都是 2。因此最大长度为<code> 1。</code>\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"abcd\", t = \"acde\", maxCost = 0\n<strong>输出:</strong>1\n<strong>解释:</strong>a -> a, cost = 0字符串未发生变化所以最大长度为 1。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= s.length, t.length <= 10^5</code></li>\n\t<li><code>0 <= maxCost <= 10^6</code></li>\n\t<li><code>s</code> 和 <code>t</code> 都只含小写英文字母。</li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 161,
"likes": 163,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -155,7 +155,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"53.7K\", \"totalSubmission\": \"108K\", \"totalAcceptedRaw\": 53688, \"totalSubmissionRaw\": 108022, \"acRate\": \"49.7%\"}",
"stats": "{\"totalAccepted\": \"55.4K\", \"totalSubmission\": \"111.1K\", \"totalAcceptedRaw\": 55371, \"totalSubmissionRaw\": 111106, \"acRate\": \"49.8%\"}",
"hints": [
"Calculate the differences between a[i] and b[i].",
"Use a sliding window to track the longest valid substring."