1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-08 08:51:42 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

移除零宽空格

This commit is contained in:
2025-05-25 15:06:02 +08:00
parent 59597532bc
commit 3070bed723
272 changed files with 1031 additions and 749 deletions

View File

@@ -6,7 +6,7 @@
"boundTopicId": null,
"title": "Count Pairs With XOR in a Range",
"titleSlug": "count-pairs-with-xor-in-a-range",
"content": "<p>Given a <strong>(0-indexed)</strong> integer array <code>nums</code> and two integers <code>low</code> and <code>high</code>, return <em>the number of <strong>nice pairs</strong></em>.</p>\r\n\r\n<p>A <strong>nice pair</strong> is a pair <code>(i, j)</code> where <code>0 &lt;= i &lt; j &lt; nums.length</code> and <code>low &lt;= (nums[i] XOR nums[j]) &lt;= high</code>.</p>\r\n\r\n<p>&nbsp;</p>\r\n<p><strong class=\"example\">Example 1:</strong></p>\r\n\r\n<pre>\r\n<strong>Input:</strong> nums = [1,4,2,7], low = 2, high = 6\r\n<strong>Output:</strong> 6\r\n<strong>Explanation:</strong> All nice pairs (i, j) are as follows:\r\n - (0, 1): nums[0] XOR nums[1] = 5 \r\n - (0, 2): nums[0] XOR nums[2] = 3\r\n - (0, 3): nums[0] XOR nums[3] = 6\r\n - (1, 2): nums[1] XOR nums[2] = 6\r\n - (1, 3): nums[1] XOR nums[3] = 3\r\n - (2, 3): nums[2] XOR nums[3] = 5\r\n</pre>\r\n\r\n<p><strong class=\"example\">Example 2:</strong></p>\r\n\r\n<pre>\r\n<strong>Input:</strong> nums = [9,8,4,2,1], low = 5, high = 14\r\n<strong>Output:</strong> 8\r\n<strong>Explanation:</strong> All nice pairs (i, j) are as follows:\r\n - (0, 2): nums[0] XOR nums[2] = 13\r\n&nbsp; - (0, 3): nums[0] XOR nums[3] = 11\r\n&nbsp; - (0, 4): nums[0] XOR nums[4] = 8\r\n&nbsp; - (1, 2): nums[1] XOR nums[2] = 12\r\n&nbsp; - (1, 3): nums[1] XOR nums[3] = 10\r\n&nbsp; - (1, 4): nums[1] XOR nums[4] = 9\r\n&nbsp; - (2, 3): nums[2] XOR nums[3] = 6\r\n&nbsp; - (2, 4): nums[2] XOR nums[4] = 5</pre>\r\n\r\n<p>&nbsp;</p>\r\n<p><strong>Constraints:</strong></p>\r\n\r\n<ul>\r\n\t<li><code>1 &lt;= nums.length &lt;= 2 * 10<sup>4</sup></code></li>\r\n\t<li><code>1 &lt;= nums[i] &lt;= 2 * 10<sup>4</sup></code></li>\r\n\t<li><code>1 &lt;= low &lt;= high &lt;= 2 * 10<sup>4</sup></code></li>\r\n</ul>",
"content": "<p>Given a <strong>(0-indexed)</strong> integer array <code>nums</code> and two integers <code>low</code> and <code>high</code>, return <em>the number of <strong>nice pairs</strong></em>.</p>\r\n\r\n<p>A <strong>nice pair</strong> is a pair <code>(i, j)</code> where <code>0 &lt;= i &lt; j &lt; nums.length</code> and <code>low &lt;= (nums[i] XOR nums[j]) &lt;= high</code>.</p>\r\n\r\n<p>&nbsp;</p>\r\n<p><strong class=\"example\">Example 1:</strong></p>\r\n\r\n<pre>\r\n<strong>Input:</strong> nums = [1,4,2,7], low = 2, high = 6\r\n<strong>Output:</strong> 6\r\n<strong>Explanation:</strong> All nice pairs (i, j) are as follows:\r\n - (0, 1): nums[0] XOR nums[1] = 5 \r\n - (0, 2): nums[0] XOR nums[2] = 3\r\n - (0, 3): nums[0] XOR nums[3] = 6\r\n - (1, 2): nums[1] XOR nums[2] = 6\r\n - (1, 3): nums[1] XOR nums[3] = 3\r\n - (2, 3): nums[2] XOR nums[3] = 5\r\n</pre>\r\n\r\n<p><strong class=\"example\">Example 2:</strong></p>\r\n\r\n<pre>\r\n<strong>Input:</strong> nums = [9,8,4,2,1], low = 5, high = 14\r\n<strong>Output:</strong> 8\r\n<strong>Explanation:</strong> All nice pairs (i, j) are as follows:\r\n - (0, 2): nums[0] XOR nums[2] = 13\r\n&nbsp; - (0, 3): nums[0] XOR nums[3] = 11\r\n&nbsp; - (0, 4): nums[0] XOR nums[4] = 8\r\n&nbsp; - (1, 2): nums[1] XOR nums[2] = 12\r\n&nbsp; - (1, 3): nums[1] XOR nums[3] = 10\r\n&nbsp; - (1, 4): nums[1] XOR nums[4] = 9\r\n&nbsp; - (2, 3): nums[2] XOR nums[3] = 6\r\n&nbsp; - (2, 4): nums[2] XOR nums[4] = 5</pre>\r\n\r\n<p>&nbsp;</p>\r\n<p><strong>Constraints:</strong></p>\r\n\r\n<ul>\r\n\t<li><code>1 &lt;= nums.length &lt;= 2 * 10<sup>4</sup></code></li>\r\n\t<li><code>1 &lt;= nums[i] &lt;= 2 * 10<sup>4</sup></code></li>\r\n\t<li><code>1 &lt;= low &lt;= high &lt;= 2 * 10<sup>4</sup></code></li>\r\n</ul>",
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": false,