https://www.geeksforgeeks.org/maximum-value-of-xor-among-all-triplets-of-an-array/
Given an array of integers ‘arr’, the task is to find the maximum XOR value of any triplet pair among all the possible triplet pairs.
Note: An array element can be used more than once.
Note: An array element can be used more than once.
Examples:
Input: arr[] = {3, 4, 5, 6}
Output: 7
The triplet with maximum XOR value is {4, 5, 6}.
- Store all possible values of XOR between all possible two-element pairs from the array in a set.
- Set data structure is used to avoid the repetitions of XOR values.
- Now, XOR between every set element and array element to get the maximum value for any triplet pair.