Bit manipulation · Easy
A compact diagnostic checksum combines a batch of 32-bit status masks using XOR. The input already contains the final masks: no filtering or reinterpretation of signed inputs is required. Equal masks at different positions must still participate.
Combine every input mask with XOR and return the result as one unsigned 32-bit integer.
Input
Call
- Implement solve(input) and return the result. The provided adapter handles JSON input and output.
Input shape
{ nums: unsigned32[] }
Fields
- nums contains unsigned 32-bit integers from 0 through 4294967295. Values with bit 31 set are positive JSON integers.
Output
Return value
- Return one unsigned integer, not a binary string. Every occurrence is included.
- An empty batch returns zero. Repeated equal masks cancel in pairs.
Constraints
- 0 <= nums.length <= 100000.
Examples
Example 1
{
"nums": [
5,
3,
5
]
}Returns
3Example 2
{
"nums": [
2147483648
]
}Returns
2147483648Required complexity
O(n) time and O(1) auxiliary space