Unique Number-III, Hackerblocks, Bitmasking

Sir how u are able to figure out that logic. Please explain about main intention of the logic.

all those numbers will contribute a given bit 3 times and the special number will contribute it for 1 time only.
so take the sum of ith set bits off all numbers , now see whether sum is 3n or 3n+1, thats your answer

I didn’t understand problem solution properly kindly please elaborate sir.


try to understand it