#3277

Maximum XOR Score Subarray Queries

master · 1615 · lc hard +32 · 43.7% accepted · 109 likes · top 25%

Description

You are given integer array nums of length n and 2D array queries where queries[i] = [li, ri]. The XOR-score of array a is obtained by repeatedly replacing each a[i] (except last) with a[i] XOR a[i+1] and removing the last, until one value remains.

For each query, return the maximum XOR-score over all subarrays of nums[li..ri].

Code

1
2
3