2
public int[] xorQueries(int[] arr, int[][] queries) {3
int[] ans = new int[queries.length];4
int[] xor = new int[arr.length];6
// computing prefix XOR of arr7
for (int i = 1; i < arr.length; i++) {8
xor[i] = arr[i] ^ xor[i - 1];10
for (int i = 0; i < queries.length; i++) {11
// if query starts from something other than 0 (say i), then we XOR all values from arr[0] to13
if (queries[i][0] != 0) {14
ans[i] = xor[queries[i][1]];15
for (int j = 0; j < queries[i][0]; j++) {16
ans[i] = arr[j] ^ ans[i];19
// if start of query is 0, then we striaght up use the prefix XOR till ith element20
else ans[i] = xor[queries[i][1]];