Given an array A of size N and a number x. count all the pairs in array such that A[i]^A[j]=x.
DON’T PROPOSE THE SOLUTIONS WITH O(N^2) AND ALSO THE SOLUTION GIVEN ON GEEKSFORGEEKS
THIS IS THE SOLUTION PROVIDED BY CODEFORCES
Note that if then . Keep in numx the number of repetitions of number x. Now for each x, add to answer. Then divide answer by 2 (if X is 0, don’t).
Time complexity: O(n).
Corner case #1 : Some codes got WA when X is 0.
Corner case #2 : Some codes got RE because can be as large as max(x, y)·2.
I couldn’t understand this solution please explain this one or some other approach.