[Solution] Max Shift After XOR CodeChef Solution | CodeChef Problem Solution 2022
You are given an array , consisting of integers.
Consider the following definitions:
- Prefix xor array of an array is defined as the array such that , where denotes bitwise XOR operation.
In other words, - The value of an array is the number of distinct values in array . For example, for array , we have . The array has distinct values, thus, the value of array is .
- One right shift on the array is a transformation that changes the array to .
Solution Click Below:- CLICK HERE
Calculate the maximum value of the array you can get, by performing any (possibly zero) number of right shifts on the array .
Input Format
- The first line of input contains the number of test cases you need to solve.
- The first line of each test case contains one integer the size of the array.
- The second line of each test case contains space-separated integers the
- elements of the array .
Output Format
For each test case, output on a new line the maximum value of an array you can achieve after performing any (possibly zero) number of right shifts on the array.
Constraints
- Sum of over all test cases doesn't exceed .
No comments:
Post a Comment