Medium

Quiz

#137 Single Number II

APPROACH

You are given an integer array nums where every element appears exactly three times except for one element which appears exactly once.

Find and return that unique element.

Your solution must run in linear time and use only constant extra space.

Example 1:

Input: nums = [2,2,3,2]
Output: 3

Example 2:

Input: nums = [0,1,0,1,0,1,99]
Output: 99
1 of 4
1:00

What is the optimal approach for this problem?