September 26, 2023
Latest:
TechInfo

# Maxi AND CodeKaze June23 Round 2 Solution || India’s Biggest Hiring Challenge

## Maxi AND CodeKaze June23 Round 2 Solution || India’s Biggest Hiring Challenge ## Problem Statement

#### Note: AND of the array is ‘A & A & A & … & A[N]’.

##### Example:
``````'N' = 3
'A' = [3, 5, 4]

We do the following operations:
Change 'A' to 'A xor 2 = 7'.
Change 'A' to 'A xor 3 = 7'.

The AND of the new array is '3 & 7 & 7 = 3'.
It can be shown that this is the maximum possible AND.
``````
##### Hint:
``````The operation can activate all bits less than an element's MSB (Most Significant Bit). Use the element with the smallest MSB to determine the answer.
``````
Detailed explanation ( Input/output format, Notes, Images ) ##### Constraints :
``````1 <= T <= 10
1 <= N <= 10^5
1 <= A[i] <= 10^6

Time Limit: 1 sec
``````
##### Sample Input 1:
``````2
4
1 3 5 8
2
6 7
``````
##### Sample Output 1:
``````1
7
``````
##### Explanation Of Sample Input 1:
``````For test case 1:
The AND of the given array is '1 & 3 & 5 & 8 = 1'.
It can be shown that this is already the maximum possible AND.

For test case 2:
We do the following operation:
Change 'A' to 'A xor 1 = 7'.

The AND of the new array is '7 & 7 = 7'.
It can be shown that this is the maximum possible AND.
``````
##### Sample Input 2:
``````2
3
10 10 10
5
15 35 25 30 20
``````
##### Sample Output 2:
``````15
15`````` 6 digit code appear after 69 seconds.

Wait for Solution