Ezvor

3215. Count Triplets with Even XOR Set Bits II

MediumArray Preparing judge… LeetCode
ArrayBit Manipulation

Hints

Hint 1
If x and y both have an even number of set bits, how many set bits do their XOR have?
Hint 2
If exactly one of x and y has an even number of set bits, how many set bits do their XOR have?
Hint 3
Conclude that if the XOR of three elements would have an even number of set bits, an even number of them (0 or 2) should have an odd number of set bits!
Hint 4
For each array count the number of elements that have even set bits and also count the ones that have odd set bits.