1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-24 14:28:56 +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>left</code>&nbsp;和&nbsp;<code>right</code> ,在闭区间 <code>[left, right]</code>&nbsp;范围内,统计并返回 <strong>计算置位位数为质数</strong> 的整数个数。</p>\n\n<p><strong>计算置位位数</strong> 就是二进制表示中 <code>1</code> 的个数。</p>\n\n<ul>\n\t<li>例如, <code>21</code>&nbsp;的二进制表示&nbsp;<code>10101</code>&nbsp;有 <code>3</code> 个计算置位。</li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>left = 6, right = 10\n<strong>输出:</strong>4\n<strong>解释:</strong>\n6 -&gt; 110 (2 个计算置位2 是质数)\n7 -&gt; 111 (3 个计算置位3 是质数)\n9 -&gt; 1001 (2 个计算置位2 是质数)\n10-&gt; 1010 (2 个计算置位2 是质数)\n共计 4 个计算置位为质数的数字。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>left = 10, right = 15\n<strong>输出:</strong>5\n<strong>解释:</strong>\n10 -&gt; 1010 (2 个计算置位, 2 是质数)\n11 -&gt; 1011 (3 个计算置位, 3 是质数)\n12 -&gt; 1100 (2 个计算置位, 2 是质数)\n13 -&gt; 1101 (3 个计算置位, 3 是质数)\n14 -&gt; 1110 (3 个计算置位, 3 是质数)\n15 -&gt; 1111 (4 个计算置位, 4 不是质数)\n共计 5 个计算置位为质数的数字。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= left &lt;= right &lt;= 10<sup>6</sup></code></li>\n\t<li><code>0 &lt;= right - left &lt;= 10<sup>4</sup></code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 70,
"likes": 129,
"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\": \"20.2K\", \"totalSubmission\": \"28.5K\", \"totalAcceptedRaw\": 20164, \"totalSubmissionRaw\": 28544, \"acRate\": \"70.6%\"}",
"stats": "{\"totalAccepted\": \"51K\", \"totalSubmission\": \"67.4K\", \"totalAcceptedRaw\": 51038, \"totalSubmissionRaw\": 67432, \"acRate\": \"75.7%\"}",
"hints": [
"Write a helper function to count the number of set bits in a number, then check whether the number of set bits is 2, 3, 5, 7, 11, 13, 17 or 19."
],