1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-22 21:46:46 +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": "<strong>n 位格雷码序列</strong> 是一个由 <code>2<sup>n</sup></code> 个整数组成的序列,其中:\n<ul>\n\t<li>每个整数都在范围 <code>[0, 2<sup>n</sup> - 1]</code> 内(含 <code>0</code> 和 <code>2<sup>n</sup> - 1</code></li>\n\t<li>第一个整数是 <code>0</code></li>\n\t<li>一个整数在序列中出现 <strong>不超过一次</strong></li>\n\t<li>每对 <strong>相邻</strong> 整数的二进制表示 <strong>恰好一位不同</strong> ,且</li>\n\t<li><strong>第一个</strong> 和 <strong>最后一个</strong> 整数的二进制表示 <strong>恰好一位不同</strong></li>\n</ul>\n\n<p>给你一个整数 <code>n</code> ,返回任一有效的 <strong>n 位格雷码序列</strong> 。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 2\n<strong>输出:</strong>[0,1,3,2]\n<strong>解释:</strong>\n[0,1,3,2] 的二进制表示是 [00,01,11,10] 。\n- 0<strong><em>0</em></strong> 和 0<em><strong>1</strong></em> 有一位不同\n- <em><strong>0</strong></em>1 和 <em><strong>1</strong></em>1 有一位不同\n- 1<em><strong>1</strong></em> 和 1<em><strong>0</strong></em> 有一位不同\n- <em><strong>1</strong></em>0 和 <em><strong>0</strong></em>0 有一位不同\n[0,2,3,1] 也是一个有效的格雷码序列,其二进制表示是 [00,10,11,01] 。\n- <em><strong>0</strong></em>0 和 <em><strong>1</strong></em>0 有一位不同\n- 1<em><strong>0</strong></em> 和 1<em><strong>1</strong></em> 有一位不同\n- <em><strong>1</strong></em>1 和 <em><strong>0</strong></em>1 有一位不同\n- 0<em><strong>1</strong></em> 和 0<em><strong>0</strong></em> 有一位不同\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 1\n<strong>输出:</strong>[0,1]\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= n &lt;= 16</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 484,
"likes": 492,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"1-bit and 2-bit Characters\", \"titleSlug\": \"1-bit-and-2-bit-characters\", \"difficulty\": \"Easy\", \"translatedTitle\": \"1 \\u6bd4\\u7279\\u4e0e 2 \\u6bd4\\u7279\\u5b57\\u7b26\"}]",
@@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"91.1K\", \"totalSubmission\": \"122.3K\", \"totalAcceptedRaw\": 91096, \"totalSubmissionRaw\": 122271, \"acRate\": \"74.5%\"}",
"stats": "{\"totalAccepted\": \"93.4K\", \"totalSubmission\": \"125.2K\", \"totalAcceptedRaw\": 93369, \"totalSubmissionRaw\": 125195, \"acRate\": \"74.6%\"}",
"hints": [],
"solution": null,
"status": null,