Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Consider what it means to be able to choose any x for the operation and which integers could be obtained from a given nums[i].
The given operation can unset any bit in nums[i].
The nth bit of the XOR of all the elements is 1 if the nth bit is 1 for an odd number of elements. When can we ensure it is odd?
Try to set every bit of the result to 1 if possible.