sir when in ans =ans^n we do ans=2^3 does it will not return
1 to ans for next increment
Unique number -1
@YASHMATHURIA123
ans=ans^n means (ans xor n). So ans=2^3 will give 1.
In this question you have to find the unique number which exist only once. All other number exits twice in the array. Just remember the property of xor, xor of same integer is zero. So If you xor whole array, the number which appears twice would cancel each other and result will be equal to unique number.
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.