You are given an integer array nums.
A XOR triplet is defined as the XOR of three elements nums[i], nums[j], and nums[k], where i <= j <= k. In other words, its value is:
nums[i] XOR nums[j] XOR nums[k]
Return the number of distinct XOR values that can be obtained from all valid triplets (i, j, k).
Input: nums = [1,3]
Output: 2
Explanation:
The possible XOR values are:
(0, 0, 0) → 1 XOR 1 XOR 1 = 1(0, 0, 1) → 1 XOR 1 XOR 3 = 3(0, 1, 1) → 1 XOR 3 XOR 3 = 1(1, 1, 1) → 3 XOR 3 XOR 3 = 3The distinct XOR values are {1, 3}, so the answer is 2.
Phonepay • Pending
Rippling • Pending
Texas • Pending
Texas • Pending
Amazon • Pending