0

Maximum XOR

Difficulty: EASY
Avg. time to solve
10 min
Success Rate
90%

Problem Statement
Suggest Edit

Given two arrays of integers find maximum value of XOR for a pair. Take one element form each array. Do it in linear time.

Input format :
The first line contains a single integer T representing the number of test cases.
Each test case consists of :-
Line 1: Integer N1 
Line 2: N1 integers separated by a space.
Line 3: Integer N2 
Line 4: N2 integers separated by a space.
Output format :
For each test case, return the maximum xor value
Constraints:
1 <= T <= 10
1 <= N1 <= 10000
1 <= N1 <= 10000

Time Limit: 1 sec
Sample Input :
1
7 
6 6 0 6 8 5 6 
7 
1 7 1 7 8 0 2 
Sample Output :
15
Explanation:
8 XOR 7 = 15
Want to solve this problem? Login now to get access to solve the problems