ENGXOR - Editorial

Parity means the number of set bits of a number in binary representation is either odd or even.simply, count number of 1’s,if its divisible by 2 means parity is 0(even) other wise 1(odd).

More generally, the parity of x is even if x is divisible by 2 and odd if it is not.

Apologies got confused

Thankyou for the editorial. It really helped me.

I have this stupid little doubt in the sample test case. The query given is 3 whose binary representation is 11 so the parity of set bits is even which means every element’s parity will change 2 times. This will result in no change in the number of even set bits of the array but the answer comes out (2, 4) which would happen if the number of set bits of the parity were odd.
Any help would be appreciated.
Thanks :smiley: