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

存量题库数据更新

This commit is contained in:
2023-12-09 18:42:21 +08:00
parent a788808cd7
commit c198538f10
10843 changed files with 288489 additions and 248355 deletions

View File

@@ -2,7 +2,7 @@
"data": {
"question": {
"questionId": "3197",
"questionFrontendId": "100124",
"questionFrontendId": "2935",
"categoryTitle": "Algorithms",
"boundTopicId": 2521613,
"title": "Maximum Strong Pair XOR II",
@@ -12,13 +12,44 @@
"translatedContent": "<p>给你一个下标从 <strong>0</strong> 开始的整数数组 <code>nums</code> 。如果一对整数 <code>x</code> 和 <code>y</code> 满足以下条件,则称其为 <strong>强数对</strong> </p>\n\n<ul>\n\t<li><code>|x - y| &lt;= min(x, y)</code></li>\n</ul>\n\n<p>你需要从 <code>nums</code> 中选出两个整数,且满足:这两个整数可以形成一个强数对,并且它们的按位异或(<code>XOR</code>)值是在该数组所有强数对中的<strong> 最大值 </strong>。</p>\n\n<p>返回数组 <code>nums</code> 所有可能的强数对中的<strong> 最大 </strong>异或值。</p>\n\n<p><strong>注意</strong>,你可以选择同一个整数两次来形成一个强数对。</p>\n\n<p>&nbsp;</p>\n\n<p><strong class=\"example\">示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,2,3,4,5]\n<strong>输出:</strong>7\n<strong>解释:</strong>数组<code> nums </code>中有 11 个强数对:(1, 1), (1, 2), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (3, 5), (4, 4), (4, 5) 和 (5, 5) 。\n这些强数对中的最大异或值是 3 XOR 4 = 7 。\n</pre>\n\n<p><strong class=\"example\">示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [10,100]\n<strong>输出:</strong>0\n<strong>解释:</strong>数组<code> nums </code>中有 2 个强数对:(10, 10) 和 (100, 100) 。\n这些强数对中的最大异或值是 10 XOR 10 = 0 ,数对 (100, 100) 的异或值也是 100 XOR 100 = 0 。\n</pre>\n\n<p><strong class=\"example\">示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [500,520,2500,3000]\n<strong>输出:</strong>1020\n<strong>解释:</strong>数组<code> nums </code>中有 6 个强数对:(500, 500), (500, 520), (520, 520), (2500, 2500), (2500, 3000) 和 (3000, 3000) 。\n这些强数对中的最大异或值是 500 XOR 520 = 1020 ;另一个异或值非零的数对是 (5, 6) ,其异或值是 2500 XOR 3000 = 636 。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= nums.length &lt;= 5 * 10<sup>4</sup></code></li>\n\t<li><code>1 &lt;= nums[i] &lt;= 2<sup>20</sup> - 1</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 4,
"likes": 11,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"contributors": [],
"langToValidPlayground": "{\"cpp\": true, \"java\": true, \"python\": true, \"python3\": true, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"typescript\": false, \"bash\": false, \"php\": false, \"swift\": false, \"kotlin\": false, \"dart\": false, \"golang\": false, \"ruby\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"rust\": false, \"racket\": false, \"erlang\": false, \"elixir\": false, \"pythondata\": false, \"react\": false, \"vanillajs\": false, \"postgresql\": false}",
"topicTags": [],
"topicTags": [
{
"name": "Bit Manipulation",
"slug": "bit-manipulation",
"translatedName": "位运算",
"__typename": "TopicTagNode"
},
{
"name": "Trie",
"slug": "trie",
"translatedName": "字典树",
"__typename": "TopicTagNode"
},
{
"name": "Array",
"slug": "array",
"translatedName": "数组",
"__typename": "TopicTagNode"
},
{
"name": "Hash Table",
"slug": "hash-table",
"translatedName": "哈希表",
"__typename": "TopicTagNode"
},
{
"name": "Sliding Window",
"slug": "sliding-window",
"translatedName": "滑动窗口",
"__typename": "TopicTagNode"
}
],
"companyTagStats": null,
"codeSnippets": [
{
@@ -136,7 +167,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"1.6K\", \"totalSubmission\": \"5.7K\", \"totalAcceptedRaw\": 1588, \"totalSubmissionRaw\": 5735, \"acRate\": \"27.7%\"}",
"stats": "{\"totalAccepted\": \"3.3K\", \"totalSubmission\": \"8.8K\", \"totalAcceptedRaw\": 3322, \"totalSubmissionRaw\": 8778, \"acRate\": \"37.8%\"}",
"hints": [
"Sort the array, now let <code>x <= y</code> which means <code>|x - y| <= min(x, y)</code> can now be written as <code>y - x <= x</code> or in other words, <code>y <= 2 * x</code>.",
"If <code>x</code> and <code>y</code> have the same number of bits, try making<code>y</code>s bits different from x if possible for each bit starting from the second most significant bit.",