mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-24 22:38:57 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>有一个需要密码才能打开的保险箱。密码是 <code>n</code> 位数, 密码的每一位是 <code>k</code> 位序列 <code>0, 1, ..., k-1</code> 中的一个 。</p>\n\n<p>你可以随意输入密码,保险箱会自动记住最后 <code>n</code> 位输入,如果匹配,则能够打开保险箱。</p>\n\n<p>举个例子,假设密码是 <code>"345"</code>,你可以输入 <code>"012345"</code> 来打开它,只是你输入了 6 个字符.</p>\n\n<p>请返回一个能打开保险箱的最短字符串。</p>\n\n<p> </p>\n\n<p><strong>示例1:</strong></p>\n\n<pre><strong>输入:</strong> n = 1, k = 2\n<strong>输出:</strong> "01"\n<strong>说明:</strong> "10"也可以打开保险箱。\n</pre>\n\n<p> </p>\n\n<p><strong>示例2:</strong></p>\n\n<pre><strong>输入:</strong> n = 2, k = 2\n<strong>输出:</strong> "00110"\n<strong>说明: </strong>"01100", "10011", "11001" 也能打开保险箱。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ol>\n\t<li><code>n</code> 的范围是 <code>[1, 4]</code>。</li>\n\t<li><code>k</code> 的范围是 <code>[1, 10]</code>。</li>\n\t<li><code>k^n</code> 最大可能为 <code>4096</code>。</li>\n</ol>\n\n<p> </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."
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user