Your submission didn't complete in the allocated time limit


#1

class Solution:
# @param A : tuple of integers
# @return an integer
def hamming(self,x,y):
res=0
while(x>0 or y>0):
res+=(x%2)^(y%2)
x>>=1
y>>=1
return res
def hammingDistance(self, A):
p=0
ah=[]
for i in range(len(A)):
for j in range(len(A)):
p=self.hamming(A[i],A[j])
ah.append§
return sum(ah)