Search topics...

Single Number II

medium
bitsTime: O(n)Space: O(1)Frequency: 3

Given an integer array where every element appears three times except for one which appears exactly once, find the single element.

Example 1:

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

Example 2:

Input: nums = [0, 1, 0, 1, 0, 1, 99]
Output: 99
bit-manipulation