Get the latest tech news
That XOR Trick (2020)
There are a whole bunch of popular interview questions that can be solved in one of two ways: Either using common data structures and algorithms in a sensible manner, or by using some properties of...
While it seems unreasonable to expect the XOR solutions in interviews, it is quite fun to figure out how they work. And I am sure you guessed it, but we will stick with what worked before and start exactly the same way: Let’s consider what happens if we use the previous XOR algorithm. If more than two elements are missing (or duplicated), then analyzing the individual bits fails because there are several combinations possible for both 0 and 1 as results.
Or read this on Hacker News