Find the one integer that appears exactly once when every other integer appears three times.
You are given an integer array nums where every value appears exactly three times, except for one value that appears exactly once.
Return the value that appears only once.
You should aim for a solution that uses constant extra space and runs in linear time.
nums.nums[i] is an integer value.Example 1
Input
nums = [2,2,3,2]
Output
3
Explanation
Every number appears three times except 3, which appears once.
Example 2
Input
nums = [0,1,0,1,0,1,99]
Output
99
Explanation
0 and 1 each appear three times, while 99 appears once.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.