mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-02 22:13:28 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你两个字符串 <code>s</code> 和 <code>t</code> ,你的目标是在 <code>k</code> 次操作以内把字符串 <code>s</code> 转变成 <code>t</code> 。</p>\n\n<p>在第 <code>i</code> 次操作时(<code>1 <= i <= k</code>),你可以选择进行如下操作:</p>\n\n<ul>\n\t<li>选择字符串 <code>s</code> 中满足 <code>1 <= j <= s.length</code> 且之前未被选过的任意下标 <code>j</code> (下标从 1 开始),并将此位置的字符切换 <code>i</code> 次。</li>\n\t<li>不进行任何操作。</li>\n</ul>\n\n<p>切换 1 个字符的意思是用字母表中该字母的下一个字母替换它(字母表环状接起来,所以 <code>'z'</code> 切换后会变成 <code>'a'</code>)。第 <code>i</code> 次操作意味着该字符应切换 <code>i</code> 次</p>\n\n<p>请记住任意一个下标 <code>j</code> 最多只能被操作 1 次。</p>\n\n<p>如果在不超过 <code>k</code> 次操作内可以把字符串 <code>s</code> 转变成 <code>t</code> ,那么请你返回 <code>true</code> ,否则请你返回 <code>false</code> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"input\", t = \"ouput\", k = 9\n<strong>输出:</strong>true\n<strong>解释:</strong>第 6 次操作时,我们将 'i' 切换 6 次得到 'o' 。第 7 次操作时,我们将 'n' 切换 7 次得到 'u' 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"abc\", t = \"bcd\", k = 10\n<strong>输出:</strong>false\n<strong>解释:</strong>我们需要将每个字符切换 1 次才能得到 t 。我们可以在第 1 次操作时将 'a' 切换成 'b' ,但另外 2 个字母在剩余操作中无法再转变为 t 中对应字母。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"aab\", t = \"bbb\", k = 27\n<strong>输出:</strong>true\n<strong>解释:</strong>第 1 次操作时,我们将第一个 'a' 切换 1 次得到 'b' 。在第 27 次操作时,我们将第二个字母 'a' 切换 27 次得到 'b' 。\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 <= k <= 10^9</code></li>\n\t<li><code>s</code> 和 <code>t</code> 只包含小写英文字母。</li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 14,
|
||||
"likes": 15,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -143,7 +143,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"5.3K\", \"totalSubmission\": \"16.5K\", \"totalAcceptedRaw\": 5301, \"totalSubmissionRaw\": 16532, \"acRate\": \"32.1%\"}",
|
||||
"stats": "{\"totalAccepted\": \"5.4K\", \"totalSubmission\": \"16.8K\", \"totalAcceptedRaw\": 5391, \"totalSubmissionRaw\": 16811, \"acRate\": \"32.1%\"}",
|
||||
"hints": [
|
||||
"Observe that shifting a letter x times has the same effect of shifting the letter x + 26 times.",
|
||||
"You need to check whether k is large enough to cover all shifts with the same remainder after modulo 26."
|
||||
|
Reference in New Issue
Block a user