Why it gives TLE


#1

int Solution::hammingDistance(const vector &a) {
long long int ans=0L;
long long int n=a.size();
for(int i=31;i>=0;iā€“)
{
long long int count0=0L;
long long int count1=0L;
for(int j=0;j<n;j++)
{
if(((a[j]>>i)&1)==0)
{
count0++;
}
else
count1++;

          			}
          		ans+=((count0*count1*2))%1000000007;
          }
          return (int)ans;

}