python
class Solution:
def singleNumber(self, nums: List[int]):
res = 0
for i in range(32):
count = 0
for num in nums:
count += (num >> i) & 1
if count % 3 != 0:
res += pow(2, i)
return res if (res>>31) & 1 == 0 else -((res^0xffffffff)+1)
版权声明:本文为VaccyZhu原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。