mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-21 21:16:45 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你两个整数 <code>n</code> 和 <code>start</code>。你的任务是返回任意 <code>(0,1,2,,...,2^n-1)</code> 的排列 <code>p</code>,并且满足:</p>\n\n<ul>\n\t<li><code>p[0] = start</code></li>\n\t<li><code>p[i]</code> 和 <code>p[i+1]</code> 的二进制表示形式只有一位不同</li>\n\t<li><code>p[0]</code> 和 <code>p[2^n -1]</code> 的二进制表示形式也只有一位不同</li>\n</ul>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong>n = 2, start = 3\n<strong>输出:</strong>[3,2,0,1]\n<strong>解释:</strong>这个排列的二进制表示是 (11,10,00,01)\n 所有的相邻元素都有一位是不同的,另一个有效的排列是 [3,1,0,2]\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输出:</strong>n = 3, start = 2\n<strong>输出:</strong>[2,6,7,5,4,0,1,3]\n<strong>解释:</strong>这个排列的二进制表示是 (010,110,111,101,100,000,001,011)\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= n <= 16</code></li>\n\t<li><code>0 <= start < 2^n</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 40,
|
||||
"likes": 41,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"3.5K\", \"totalSubmission\": \"5.3K\", \"totalAcceptedRaw\": 3544, \"totalSubmissionRaw\": 5328, \"acRate\": \"66.5%\"}",
|
||||
"stats": "{\"totalAccepted\": \"3.6K\", \"totalSubmission\": \"5.5K\", \"totalAcceptedRaw\": 3635, \"totalSubmissionRaw\": 5474, \"acRate\": \"66.4%\"}",
|
||||
"hints": [
|
||||
"Use gray code to generate a n-bit sequence.",
|
||||
"Rotate the sequence such that its first element is start."
|
||||
|
Reference in New Issue
Block a user