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>num</code> ,该字符串表示一个大整数。另给你一个长度为 <code>10</code> 且 <strong>下标从 0 开始</strong> 的整数数组 <code>change</code> ,该数组将 <code>0-9</code> 中的每个数字映射到另一个数字。更规范的说法是,数字 <code>d</code> 映射为数字 <code>change[d]</code> 。</p>\n\n<p>你可以选择 <strong>突变</strong> <code>num</code> 的任一子字符串。<strong>突变</strong> 子字符串意味着将每位数字 <code>num[i]</code> 替换为该数字在 <code>change</code> 中的映射(也就是说,将 <code>num[i]</code> 替换为 <code>change[num[i]]</code>)。</p>\n\n<p>请你找出在对 <code>num</code> 的任一子字符串执行突变操作(也可以不执行)后,可能得到的 <strong>最大整数</strong> ,并用字符串表示返回。</p>\n\n<p><strong>子字符串</strong> 是字符串中的一个连续序列。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong>num = \"<strong><em>1</em></strong>32\", change = [9,8,5,0,3,6,4,2,6,8]\n<strong>输出:</strong>\"<strong><em>8</em></strong>32\"\n<strong>解释:</strong>替换子字符串 \"1\":\n- 1 映射为 change[1] = 8 。\n因此 \"<strong><em>1</em></strong>32\" 变为 \"<strong><em>8</em></strong>32\" 。\n\"832\" 是可以构造的最大整数,所以返回它的字符串表示。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong>num = \"<strong><em>021</em></strong>\", change = [9,4,3,5,7,2,1,9,0,6]\n<strong>输出:</strong>\"<strong><em>934</em></strong>\"\n<strong>解释:</strong>替换子字符串 \"021\":\n- 0 映射为 change[0] = 9 。\n- 2 映射为 change[2] = 3 。\n- 1 映射为 change[1] = 4 。\n因此,\"<strong><em>021</em></strong>\" 变为 \"<strong><em>934</em></strong>\" 。\n\"934\" 是可以构造的最大整数,所以返回它的字符串表示。 \n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre><strong>输入:</strong>num = \"5\", change = [1,4,7,5,3,2,5,6,9,4]\n<strong>输出:</strong>\"5\"\n<strong>解释:</strong>\"5\" 已经是可以构造的最大整数,所以返回它的字符串表示。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= num.length <= 10<sup>5</sup></code></li>\n\t<li><code>num</code> 仅由数字 <code>0-9</code> 组成</li>\n\t<li><code>change.length == 10</code></li>\n\t<li><code>0 <= change[d] <= 9</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 9,
|
||||
"likes": 10,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"6K\", \"totalSubmission\": \"19.2K\", \"totalAcceptedRaw\": 5968, \"totalSubmissionRaw\": 19233, \"acRate\": \"31.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"6.1K\", \"totalSubmission\": \"19.5K\", \"totalAcceptedRaw\": 6068, \"totalSubmissionRaw\": 19477, \"acRate\": \"31.2%\"}",
|
||||
"hints": [
|
||||
"Should you change a digit if the new digit is smaller than the original?",
|
||||
"If changing the first digit and the last digit both make the number bigger, but you can only change one of them; which one should you change?",
|
||||
|
Reference in New Issue
Block a user