the code that Prateek bhaiya told in this lecture for unique number works fine only if a number or numbers is repeated twice .If a number is repeated more than twice then it gives wrong answer.Why?
Unique number1 question
this logic works as long as we have a single number which is occuring only once and all other elements occuring in multiples of 2.
reason is -> xor of number with itself is zero. so all number which occurs in multiple of 2’s (2,4,6 etc) will cancel each other and result xor will be the required number.