1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-24 22:38:57 +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>有一个需要密码才能打开的保险箱。密码是&nbsp;<code>n</code> 位数, 密码的每一位是&nbsp;<code>k</code>&nbsp;位序列&nbsp;<code>0, 1, ..., k-1</code>&nbsp;中的一个 。</p>\n\n<p>你可以随意输入密码,保险箱会自动记住最后&nbsp;<code>n</code>&nbsp;位输入,如果匹配,则能够打开保险箱。</p>\n\n<p>举个例子,假设密码是&nbsp;<code>&quot;345&quot;</code>,你可以输入&nbsp;<code>&quot;012345&quot;</code>&nbsp;来打开它,只是你输入了 6&nbsp;个字符.</p>\n\n<p>请返回一个能打开保险箱的最短字符串。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例1:</strong></p>\n\n<pre><strong>输入:</strong> n = 1, k = 2\n<strong>输出:</strong> &quot;01&quot;\n<strong>说明:</strong> &quot;10&quot;也可以打开保险箱。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>示例2:</strong></p>\n\n<pre><strong>输入:</strong> n = 2, k = 2\n<strong>输出:</strong> &quot;00110&quot;\n<strong>说明: </strong>&quot;01100&quot;, &quot;10011&quot;, &quot;11001&quot; 也能打开保险箱。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ol>\n\t<li><code>n</code> 的范围是&nbsp;<code>[1, 4]</code>。</li>\n\t<li><code>k</code> 的范围是&nbsp;<code>[1, 10]</code>。</li>\n\t<li><code>k^n</code> 最大可能为&nbsp;<code>4096</code>。</li>\n</ol>\n\n<p>&nbsp;</p>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 94,
"likes": 96,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"4K\", \"totalSubmission\": \"6.6K\", \"totalAcceptedRaw\": 3993, \"totalSubmissionRaw\": 6592, \"acRate\": \"60.6%\"}",
"stats": "{\"totalAccepted\": \"4.1K\", \"totalSubmission\": \"6.8K\", \"totalAcceptedRaw\": 4112, \"totalSubmissionRaw\": 6760, \"acRate\": \"60.8%\"}",
"hints": [
"We can think of this problem as the problem of finding an Euler path (a path visiting every edge exactly once) on the following graph: there are $$k^{n-1}$$ nodes with each node having $$k$$ edges. It turns out this graph always has an Eulerian circuit (path starting where it ends.)\r\n\r\nWe should visit each node in \"post-order\" so as to not get stuck in the graph prematurely."
],