package leetcode;

import java.util.Arrays;

/**
 * https://leetcode.com/problems/xor-queries-of-a-subarray/
 */
public class Problem1310 {
    public int[] xorQueries(int[] arr, int[][] queries) {
        // TODO
        return null;
    }

    public static void main(String[] args) {
        Problem1310 prob = new Problem1310();
        System.out.println(Arrays.toString(prob.xorQueries(new int[]{1,3,4,8}, new int[][]{
            {0,1},{1,2},{0,3},{3,3}
        }))); // [2,7,14,8]
        System.out.println(Arrays.toString(prob.xorQueries(new int[]{4,8,2,10}, new int[][]{
            {2,3},{1,3},{0,0},{0,3}
        }))); // [8,0,4,4]
    }
}

@@ -203,35 +203,317 @@
     
-// TODO%0A        return null
+int%5B%5D answer = new int%5Bqueries.length%5D;%0A        for (int i = 0; i %3C queries.length; i++) %7B%0A            int xor = arr%5Bqueries%5Bi%5D%5B0%5D%5D;%0A            for (int j = queries%5Bi%5D%5B0%5D + 1; j %3C= queries%5Bi%5D%5B1%5D; j++) %7B%0A                xor %5E= arr%5Bj%5D;%0A            %7D%0A            answer%5Bi%5D = xor;%0A        %7D%0A        return answer
 ;%0A  
@@ -889,24 +889,24 @@
 %7B0,0%7D,%7B0,3%7D%0A
-
         %7D)))
@@ -920,16 +920,161 @@
 ,0,4,4%5D%0A
+        System.out.println(Arrays.toString(prob.xorQueries(new int%5B%5D%7B16%7D, new int%5B%5D%5B%5D%7B%0A            %7B0,0%7D,%7B0,0%7D,%7B0,0%7D%0A        %7D))); // %5B16,16,16%5D%0A
     %7D%0A%7D%0A

Update problem 1310