MaxXOR

You are given an array A of n integers (A1, A2 , … , An) and some queries. In each query, you will be given an integer D. Your task is to find an integer Ai (1 ≤ i ≤ n) such that XOR operation between D and Ai gives the maximum result. According to Wikipedia, “Exclusive or or exclusive disjunction is a logical operation that outputs true only when inputs differ (one is true, the other is false)”.


This is a companion discussion topic for the original entry at https://toph.co/p/maxxor