1301-1310

1301. Number of Paths with Max Score \star\star\star

1302. Deepest Leaves Sum \star\star

1303. Find the Team Size \star

1304. Find N Unique Integers Sum up to Zero \star

1305. All Elements in Two Binary Search Trees \star\star

1306. Jump Game III \star\star

1307. Verbal Arithmetic Puzzle \star\star\star

1308. Running Total for Different Genders \star\star

1309. Decrypt String from Alphabet to Integer Mapping \star

1310. XOR Queries of a Subarray \star\star

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
class Solution {
 public:
  vector<int> xorQueries(vector<int>& arr, vector<vector<int>>& queries) {
    vector<int> ans;
    vector<int> xors(arr.size() + 1);

    for (int i = 0; i < arr.size(); ++i) xors[i + 1] ^= xors[i] ^ arr[i];

    for (vector<int>& query : queries)
      ans.push_back(xors[query[0]] ^ xors[query[1] + 1]);

    return ans;
  }
};