1310. Check if XOR of Array is Zero

EasyBit ManipulationBit ManipulationXORArray

Given an array of integers, determine whether the XOR of all its elements is 0. Return true if the cumulative XOR is zero, otherwise false.

Input: A JSON object {"nums": [<integers>]}.

Output: Return true if the XOR of every element is 0, otherwise false.

Examples

Example 1
Input: {"nums":[1,2,3]}
Output: true
Explanation: 1^2^3 = 0 -> true.
Example 2
Input: {"nums":[1,2,4]}
Output: false
Explanation: 1^2^4 = 7 -> false.

Constraints

Asked by

TCSInfosysWiproCognizantCapgemini
Solve this problem in the editor →