Single Number III

Medium · Bit Manipulation · about 20 minutes

Asked at Amazon, Google, Meta, Microsoft.

In an integer array nums, exactly two elements appear only once and every other element appears exactly twice. Return the two single elements, in any order, using O(n) time and O(1) extra space.