XOR-ORED solution codechef
Given an array bitwise XOR operation.of non-negative integers, you can choose any non-negative integer and replace every element with Here, denotes the
Using the above operation exactly once, your goal is to minimize the bitwise OR of the new array. In other words, find bitwise OR operation.such that is minimized, where denotes the
Find the value ofand the minimum possible bitwise OR of the new array.
- The first line contains a single integer – the number of test cases. Then test cases follow.
- The first line of each test case contains a single integer – the length of the array.
- The next line contains integers .
For each test case, print two integers:and the minimum possible bitwise OR of the new array.
If there are multiple values ofthat achieve the minimum bitwise OR, print any of them.
Sample Input 1
1 2 4 6
Sample Output 1
Here, if we take, then our expression would become , which is the minimum possible.