mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-06 07:51:41 +08:00
update
This commit is contained in:
@@ -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": 159,
|
||||
"likes": 161,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"53.5K\", \"totalSubmission\": \"107.7K\", \"totalAcceptedRaw\": 53497, \"totalSubmissionRaw\": 107702, \"acRate\": \"49.7%\"}",
|
||||
"stats": "{\"totalAccepted\": \"53.7K\", \"totalSubmission\": \"108K\", \"totalAcceptedRaw\": 53688, \"totalSubmissionRaw\": 108022, \"acRate\": \"49.7%\"}",
|
||||
"hints": [
|
||||
"Calculate the differences between a[i] and b[i].",
|
||||
"Use a sliding window to track the longest valid substring."
|
||||
|
Reference in New Issue
Block a user