Solution: Single Number II

Let's solve the Single Number II problem using the Bitwise Manipulation pattern.

Statement

Given a non-empty array arr, in which exactly two elements appear once, and all the other elements appear twice, return the two elements that appeared only once.

Note: The result can be returned in any order. The solution should use only constant extra space.

Constraints:

  • 22 \leq arr.length 103\leq 10^3

  • ...

Access this course and 1400+ top-rated courses and projects.