mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-02 14:12:17 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个整数 <code>n</code> ,对于 <code>0 <= i <= n</code> 中的每个 <code>i</code> ,计算其二进制表示中 <strong><code>1</code> 的个数</strong> ,返回一个长度为 <code>n + 1</code> 的数组 <code>ans</code> 作为答案。</p>\n\n<p> </p>\n\n<div class=\"original__bRMd\">\n<div>\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 2\n<strong>输出:</strong>[0,1,1]\n<strong>解释:</strong>\n0 --> 0\n1 --> 1\n2 --> 10\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 5\n<strong>输出:</strong>[0,1,1,2,1,2]\n<strong>解释:</strong>\n0 --> 0\n1 --> 1\n2 --> 10\n3 --> 11\n4 --> 100\n5 --> 101\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>0 <= n <= 10<sup>5</sup></code></li>\n</ul>\n\n<p> </p>\n\n<p><strong>进阶:</strong></p>\n\n<ul>\n\t<li>很容易就能实现时间复杂度为 <code>O(n log n)</code> 的解决方案,你可以在线性时间复杂度 <code>O(n)</code> 内用一趟扫描解决此问题吗?</li>\n\t<li>你能不使用任何内置函数解决此问题吗?(如,C++ 中的 <code>__builtin_popcount</code> )</li>\n</ul>\n</div>\n</div>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 946,
|
||||
"likes": 948,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"Number of 1 Bits\", \"titleSlug\": \"number-of-1-bits\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u4f4d1\\u7684\\u4e2a\\u6570\"}]",
|
||||
@@ -143,7 +143,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"198K\", \"totalSubmission\": \"251.7K\", \"totalAcceptedRaw\": 198019, \"totalSubmissionRaw\": 251682, \"acRate\": \"78.7%\"}",
|
||||
"stats": "{\"totalAccepted\": \"198.7K\", \"totalSubmission\": \"252.6K\", \"totalAcceptedRaw\": 198736, \"totalSubmissionRaw\": 252616, \"acRate\": \"78.7%\"}",
|
||||
"hints": [
|
||||
"You should make use of what you have produced already.",
|
||||
"Divide the numbers in ranges like [2-3], [4-7], [8-15] and so on. And try to generate new range from previous.",
|
||||
|
Reference in New Issue
Block a user