Tap here to switch tabs
Problem
Submissions

Problem: Number of Unique XOR Triplets I

med
30 min
Try to solve the Number of Unique XOR Triplets I problem.

Statement

You are given an integer array nums of length n, which is a permutation of the integers from 11 to n.

You can select any three indices i, j, and k (0≤i,j,k<n0 \leq i, j, k < n), where the indices are not necessarily distinct, and calculate the bitwise XOR sum nums[i] ^ nums[j] ^ nums[k].

Return the total number of unique XOR values that can be formed across all possible triplets.

Constraints:

  • 1≤1 \leq n ==== nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤\leq n

  • nums is a permutation of integers from 11 to n.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Unique XOR Triplets I

med
30 min
Try to solve the Number of Unique XOR Triplets I problem.

Statement

You are given an integer array nums of length n, which is a permutation of the integers from 11 to n.

You can select any three indices i, j, and k (0≤i,j,k<n0 \leq i, j, k < n), where the indices are not necessarily distinct, and calculate the bitwise XOR sum nums[i] ^ nums[j] ^ nums[k].

Return the total number of unique XOR values that can be formed across all possible triplets.

Constraints:

  • 1≤1 \leq n ==== nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤\leq n

  • nums is a permutation of integers from 11 to n.