Number of Unique XOR Triplets II

You are given an integer array nums.

A XOR triplet is defined as the XOR of three elements nums[i] XOR nums[j] XOR nums[k] where i <= j <= k.

Return the number of unique XOR triplet values from all possible triplets (i, j, k).

Example 1
Inputnums = [1,3]
Output2
The unique XOR values from all possible triplets are {1, 3}, so the output is 2.
Example 2
Inputnums = [6,7,8,9]
Output4
The possible XOR triplet values are {6, 7, 8, 9}, so the output is 4.

Constraints

  • 1 <= nums.length <= 1500
  • 1 <= nums[i] <= 1500

Asked at 1 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate