1310. XOR Queries of a Subarray

Practice XOR Queries of a Subarray for free on NudgeCode: Medium, Bit Manipulation pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

You are given an array arr of positive integers and a list of queries. Each query [l, r] uses 0-based indices with l <= r and asks for the XOR of every element from arr[l] through arr[r], both ends included. Return the answers in the same order as the queries.

Example

arr = [1,3,4,8], queries = [[0,1],[1,2],[0,3],[3,3]]  ->  [2,7,14,8]

Constraints