End of Year Sale: Use Coupon Code END2025 to Get Extra 25% Off.
bitmask to 0 and XOR all numbers in nums to find the XOR of the two unique numbers.diff to bitmask & (-bitmask) to isolate the rightmost 1-bit.x and y to 0. These will hold the two unique numbers.nums again and for each number num, check if num & diff is nonzero.num & diff is nonzero, XOR num with x. Otherwise, XOR num with y.x and y will be the two unique numbers.[x, y].