mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-07 08:21:41 +08:00
移除零宽空格
This commit is contained in:
@@ -7,9 +7,9 @@
|
||||
"boundTopicId": 665735,
|
||||
"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 <= i < j < nums.length</code> and <code>low <= (nums[i] XOR nums[j]) <= high</code>.</p>\r\n\r\n<p> </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 - (0, 3): nums[0] XOR nums[3] = 11\r\n - (0, 4): nums[0] XOR nums[4] = 8\r\n - (1, 2): nums[1] XOR nums[2] = 12\r\n - (1, 3): nums[1] XOR nums[3] = 10\r\n - (1, 4): nums[1] XOR nums[4] = 9\r\n - (2, 3): nums[2] XOR nums[3] = 6\r\n - (2, 4): nums[2] XOR nums[4] = 5</pre>\r\n\r\n<p> </p>\r\n<p><strong>Constraints:</strong></p>\r\n\r\n<ul>\r\n\t<li><code>1 <= nums.length <= 2 * 10<sup>4</sup></code></li>\r\n\t<li><code>1 <= nums[i] <= 2 * 10<sup>4</sup></code></li>\r\n\t<li><code>1 <= low <= high <= 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 <= i < j < nums.length</code> and <code>low <= (nums[i] XOR nums[j]) <= high</code>.</p>\r\n\r\n<p> </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 - (0, 3): nums[0] XOR nums[3] = 11\r\n - (0, 4): nums[0] XOR nums[4] = 8\r\n - (1, 2): nums[1] XOR nums[2] = 12\r\n - (1, 3): nums[1] XOR nums[3] = 10\r\n - (1, 4): nums[1] XOR nums[4] = 9\r\n - (2, 3): nums[2] XOR nums[3] = 6\r\n - (2, 4): nums[2] XOR nums[4] = 5</pre>\r\n\r\n<p> </p>\r\n<p><strong>Constraints:</strong></p>\r\n\r\n<ul>\r\n\t<li><code>1 <= nums.length <= 2 * 10<sup>4</sup></code></li>\r\n\t<li><code>1 <= nums[i] <= 2 * 10<sup>4</sup></code></li>\r\n\t<li><code>1 <= low <= high <= 2 * 10<sup>4</sup></code></li>\r\n</ul>",
|
||||
"translatedTitle": "统计异或值在范围内的数对有多少",
|
||||
"translatedContent": "<p>给你一个整数数组 <code>nums</code> (下标 <strong>从 0 开始</strong> 计数)以及两个整数:<code>low</code> 和 <code>high</code> ,请返回 <strong>漂亮数对</strong> 的数目。</p>\n\n<p><strong>漂亮数对</strong> 是一个形如 <code>(i, j)</code> 的数对,其中 <code>0 <= i < j < nums.length</code> 且 <code>low <= (nums[i] XOR nums[j]) <= high</code> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong>nums = [1,4,2,7], low = 2, high = 6\n<strong>输出:</strong>6\n<strong>解释:</strong>所有漂亮数对 (i, j) 列出如下:\n - (0, 1): nums[0] XOR nums[1] = 5 \n - (0, 2): nums[0] XOR nums[2] = 3\n - (0, 3): nums[0] XOR nums[3] = 6\n - (1, 2): nums[1] XOR nums[2] = 6\n - (1, 3): nums[1] XOR nums[3] = 3\n - (2, 3): nums[2] XOR nums[3] = 5\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong>nums = [9,8,4,2,1], low = 5, high = 14\n<strong>输出:</strong>8\n<strong>解释:</strong>所有漂亮数对 (i, j) 列出如下:\n - (0, 2): nums[0] XOR nums[2] = 13\n - (0, 3): nums[0] XOR nums[3] = 11\n - (0, 4): nums[0] XOR nums[4] = 8\n - (1, 2): nums[1] XOR nums[2] = 12\n - (1, 3): nums[1] XOR nums[3] = 10\n - (1, 4): nums[1] XOR nums[4] = 9\n - (2, 3): nums[2] XOR nums[3] = 6\n - (2, 4): nums[2] XOR nums[4] = 5</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 2 * 10<sup>4</sup></code></li>\n\t<li><code>1 <= nums[i] <= 2 * 10<sup>4</sup></code></li>\n\t<li><code>1 <= low <= high <= 2 * 10<sup>4</sup></code></li>\n</ul>\n",
|
||||
"translatedContent": "<p>给你一个整数数组 <code>nums</code> (下标 <strong>从 0 开始</strong> 计数)以及两个整数:<code>low</code> 和 <code>high</code> ,请返回 <strong>漂亮数对</strong> 的数目。</p>\n\n<p><strong>漂亮数对</strong> 是一个形如 <code>(i, j)</code> 的数对,其中 <code>0 <= i < j < nums.length</code> 且 <code>low <= (nums[i] XOR nums[j]) <= high</code> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><strong>输入:</strong>nums = [1,4,2,7], low = 2, high = 6\n<strong>输出:</strong>6\n<strong>解释:</strong>所有漂亮数对 (i, j) 列出如下:\n - (0, 1): nums[0] XOR nums[1] = 5 \n - (0, 2): nums[0] XOR nums[2] = 3\n - (0, 3): nums[0] XOR nums[3] = 6\n - (1, 2): nums[1] XOR nums[2] = 6\n - (1, 3): nums[1] XOR nums[3] = 3\n - (2, 3): nums[2] XOR nums[3] = 5\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><strong>输入:</strong>nums = [9,8,4,2,1], low = 5, high = 14\n<strong>输出:</strong>8\n<strong>解释:</strong>所有漂亮数对 (i, j) 列出如下:\n - (0, 2): nums[0] XOR nums[2] = 13\n - (0, 3): nums[0] XOR nums[3] = 11\n - (0, 4): nums[0] XOR nums[4] = 8\n - (1, 2): nums[1] XOR nums[2] = 12\n - (1, 3): nums[1] XOR nums[3] = 10\n - (1, 4): nums[1] XOR nums[4] = 9\n - (2, 3): nums[2] XOR nums[3] = 6\n - (2, 4): nums[2] XOR nums[4] = 5</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 2 * 10<sup>4</sup></code></li>\n\t<li><code>1 <= nums[i] <= 2 * 10<sup>4</sup></code></li>\n\t<li><code>1 <= low <= high <= 2 * 10<sup>4</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 187,
|
||||
|
Reference in New Issue
Block a user