I think this works for positive numbers (7/11 test cases). How to I make it work for negative numbers?

```
def singleNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
res = 0
for i in xrange(32):
x = 1 << i
y = 0
for j in nums:
y += j & x
if (y >> i) % 3 != 0:
res |= x
return res
```