XOR operation: a XOR 0 = a a XOR a = 0 a XOR b XOR a = (a XOR a) XOR b = 0 XOR b = b Reference: https://leetcode.com/articles/single-number/