题目:
题解:
int totalHammingDistance(int* nums, int numsSize) {
int ans = 0;
for (int i = 0; i < 30; ++i) {
int c = 0;
for (int j = 0; j < numsSize; ++j) {
c += (nums[j] >> i) & 1;
}
ans += c * (numsSize - c);
}
return ans;
}