mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-22 21:46:46 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>有一个正整数数组 <code>arr</code>,现给你一个对应的查询数组 <code>queries</code>,其中 <code>queries[i] = [L<sub>i, </sub>R<sub>i</sub>]</code>。</p>\n\n<p>对于每个查询 <code>i</code>,请你计算从 <code>L<sub>i</sub></code> 到 <code>R<sub>i</sub></code> 的 <strong>XOR</strong> 值(即 <code>arr[L<sub>i</sub>] <strong>xor</strong> arr[L<sub>i</sub>+1] <strong>xor</strong> ... <strong>xor</strong> arr[R<sub>i</sub>]</code>)作为本次查询的结果。</p>\n\n<p>并返回一个包含给定查询 <code>queries</code> 所有结果的数组。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>arr = [1,3,4,8], queries = [[0,1],[1,2],[0,3],[3,3]]\n<strong>输出:</strong>[2,7,14,8] \n<strong>解释:</strong>\n数组中元素的二进制表示形式是:\n1 = 0001 \n3 = 0011 \n4 = 0100 \n8 = 1000 \n查询的 XOR 值为:\n[0,1] = 1 xor 3 = 2 \n[1,2] = 3 xor 4 = 7 \n[0,3] = 1 xor 3 xor 4 xor 8 = 14 \n[3,3] = 8\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>arr = [4,8,2,10], queries = [[2,3],[1,3],[0,0],[0,3]]\n<strong>输出:</strong>[8,0,4,4]\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= arr.length <= 3 * 10^4</code></li>\n\t<li><code>1 <= arr[i] <= 10^9</code></li>\n\t<li><code>1 <= queries.length <= 3 * 10^4</code></li>\n\t<li><code>queries[i].length == 2</code></li>\n\t<li><code>0 <= queries[i][0] <= queries[i][1] < arr.length</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 142,
|
||||
"likes": 143,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"38.6K\", \"totalSubmission\": \"53.9K\", \"totalAcceptedRaw\": 38562, \"totalSubmissionRaw\": 53911, \"acRate\": \"71.5%\"}",
|
||||
"stats": "{\"totalAccepted\": \"38.8K\", \"totalSubmission\": \"54.3K\", \"totalAcceptedRaw\": 38832, \"totalSubmissionRaw\": 54254, \"acRate\": \"71.6%\"}",
|
||||
"hints": [
|
||||
"What is the result of x ^ y ^ x ?",
|
||||
"Compute the prefix sum for XOR.",
|
||||
|
Reference in New Issue
Block a user