Why is this sollution not working for this question?

Why is this sollution not working for this question?
https://practice.geeksforgeeks.org/problems/counts-zeros-xor-pairs/0#ExpectOP

And Also tell some better method than O(n2) approach?

hi @cbcao263 XOR of 2 numbers is 0 only if they are same. So you can use hashing to make a frequency map so you can directly count the number of 0 xor pairs

@cbcao263 as for the current solution
if( (a[i]^a[j]) == 0)
use brackets here to ensure the precendence of the operators.

@cbcao263 please do not re-open your doubt again and again, you can simply reply to this doubt itself withouth re-opening it.

In hashing like We can have a map like map<int,int> one for number and other int for the frequency and then we can iterate over the map and then we can find nC2 as we have to make pairs. Am I correct?

@cbcao263 yes that is correct

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.