3277. Maximum XOR Score Subarray Queries
You are given an array
nums
ofn
integers, and a 2D integer arrayqueries
of sizeq
, wherequeries[i] = [li, ri]
.For each query, you must find the maximum XOR score of any subarray of
nums[li..ri]
.The XOR score of an array
a
is found by repeatedly applying the following operations ona
so that only one element remains, that is the score:
- Simultaneously replace
a[i]
witha[i] XOR a[i + 1]
for all indicesi
except the last one.- Remove the last element of
a
.Return an array
answer
of sizeq
whereanswer[i]
is the answer to queryi
.
1 | int dp[2020][2020], dpp[2020][2020]; |