```
class Solution {
public:
int singleNumber(vector<int>& nums)
{
typedef unsigned int uint32;
uint32 single = 0;
for(int nth_bit=0; nth_bit < 32; nth_bit++)
{
uint32 cnt = 0;
for(vector<int>::size_type i = 0; i < nums.size(); i++)
if( (static_cast<uint32>(nums[i]) >> nth_bit) & 0x01 )
cnt++;
if(cnt % 3)
single |= (0x01 << nth_bit);
}
return static_cast<int>(single);
}
};
```