#3514

Number of Unique XOR Triplets II

medium · 32.4% accepted · 43 likes · top 10%

array · math · bit manipulation · enumeration

Description

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).

Solution