题目
https://leetcode.com/problems/total-hamming-distance/
题解
class Solution {public int totalHammingDistance(int[] nums) {int N = nums.length;int[] count = new int[32];for (int n : nums) {for (int i = 0; i < 32; i++) {count[i] += (n >> i) & 1;}}int result = 0;for (int c : count) {result += c * (N - c);}return result;}
}