137. Single Number II

class Solution:
def singleNumber(self, nums: List[int]) -> int:
low_bits = high_bits = 0
for num in nums:
low_bits = ~high_bits & (low_bits ^ num)
high_bits = ~low_bits & (high_bits ^ num)
return low_bits
class Solution {
public:
uint32_t reverseBits(uint32_t n) {
uint32_t ret = 0;
for(int i=0;i<32;++i)
{
ret = ret<<1;
if(n&(1<<i))
{
ret += 1;
}
}
return ret;
}
};

Reference

Data Scientist/MLE/SWE @takemobi