1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-05 15:31:43 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-03-29 16:56:27 +08:00
parent e730aa6794
commit ad15da05aa
2517 changed files with 7358 additions and 7332 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>一个 <strong>k 镜像数字</strong>&nbsp;指的是一个在十进制和 k 进制下从前往后读和从后往前读都一样的&nbsp;<strong>没有前导 0</strong>&nbsp;的&nbsp;<strong>正</strong>&nbsp;整数。</p>\n\n<ul>\n\t<li>比方说,<code>9</code>&nbsp;是一个 2 镜像数字。<code>9</code>&nbsp;在十进制下为&nbsp;<code>9</code>&nbsp;,二进制下为&nbsp;<code>1001</code>&nbsp;,两者从前往后读和从后往前读都一样。</li>\n\t<li>相反地,<code>4</code>&nbsp;不是一个 2 镜像数字。<code>4</code>&nbsp;在二进制下为&nbsp;<code>100</code>&nbsp;,从前往后和从后往前读不相同。</li>\n</ul>\n\n<p>给你进制&nbsp;<code>k</code>&nbsp;和一个数字&nbsp;<code>n</code>&nbsp;,请你返回 k 镜像数字中 <strong>最小</strong> 的 <code>n</code>&nbsp;个数 <strong>之和</strong>&nbsp;。</p>\n\n<p>&nbsp;</p>\n\n<p><b>示例 1</b></p>\n\n<pre><b>输入:</b>k = 2, n = 5\n<b>输出:</b>25\n<strong>解释:\n</strong>最小的 5 个 2 镜像数字和它们的二进制表示如下:\n 十进制 二进制\n 1 1\n 3 11\n 5 101\n 7 111\n 9 1001\n它们的和为 1 + 3 + 5 + 7 + 9 = 25 。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><b>输入:</b>k = 3, n = 7\n<b>输出:</b>499\n<strong>解释:\n</strong>7 个最小的 3 镜像数字和它们的三进制表示如下:\n 十进制 三进制\n 1 1\n 2 2\n 4 11\n 8 22\n 121 11111\n 151 12121\n 212 21212\n它们的和为 1 + 2 + 4 + 8 + 121 + 151 + 212 = 499 。\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre><b>输入:</b>k = 7, n = 17\n<b>输出:</b>20379000\n<b>解释:</b>17 个最小的 7 镜像数字分别为:\n1, 2, 3, 4, 5, 6, 8, 121, 171, 242, 292, 16561, 65656, 2137312, 4602064, 6597956, 6958596\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>2 &lt;= k &lt;= 9</code></li>\n\t<li><code>1 &lt;= n &lt;= 30</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 21,
"likes": 22,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"2.5K\", \"totalSubmission\": \"6.1K\", \"totalAcceptedRaw\": 2497, \"totalSubmissionRaw\": 6087, \"acRate\": \"41.0%\"}",
"stats": "{\"totalAccepted\": \"2.5K\", \"totalSubmission\": \"6.1K\", \"totalAcceptedRaw\": 2514, \"totalSubmissionRaw\": 6114, \"acRate\": \"41.1%\"}",
"hints": [
"Since we need to reduce search space, instead of checking if every number is a palindrome in base-10, can we try to \"generate\" the palindromic numbers?",
"If you are provided with a d digit number, how can you generate a palindrome with 2*d or 2*d - 1 digit?",