TLDR Web Dev · MISCELLANEOUS
THAT XOR TRICK
Summary from the TLDR Web Dev newsletter
The XOR (exclusive or) bitwise operation has its applications in solving interview questions. The "XOR trick" is where duplicated values in a sequence of XOR operations cancel each other out. This trick can be applied to solve problems like in-place swapping of variables, finding a missing number in an array, finding a duplicate number, and even finding two missing/duplicate numbers.