OR-XOR
Practice
3.8 (5 votes)
Basic programming
Problem
61% Success 2275 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Given an array \(A\) of size \(N\), you could choose some non-negative number \(X\) and change every element of the given array to \(A_i = A_i \oplus X\)
Here, \(\oplus\) denotes the bitwise XOR operation.
Print the number of total possible values of \(X\) for which bitwise OR of every element of the array would be minimum.
Input format
- The first line contains \(T\) denoting the number of test cases.
- The first line of each test case contains integers \(N\), denoting the size of the array \(A\).
- The next line contains \(N\) integers.
Output format
Print the number of total possible values of \(X\) for which bitwise OR of every element of the array would be minimum.
Constraints
\(1 \leq T \leq 5000\)
\(1 \leq N \leq 10^5\)
\(0 \leq A_i \leq 10^9\)
The sum of \(N\) over all test cases does not exceed \(2 \cdot 10^5\)
Submissions
Please login to view your submissions
Similar Problems
Points:30
21 votes
Tags:
Basic ProgrammingMathMedium
Points:30
3 votes
Tags:
Basic ProgrammingBasics of ImplementationHash MapsImplementationMedium
Points:30
3 votes
Tags:
ApprovedMapsMediumSetsapprovedhiringrecruit
Editorial