package leetcode;

/**
 * https://leetcode.com/problems/total-hamming-distance/
 */
public class Problem477 {
    public int totalHammingDistance(int[] nums) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem477 prob = new Problem477();
        System.out.println(prob.totalHammingDistance(new int[]{4, 14, 2})); // 6
    }
}

@@ -165,38 +165,94 @@
     
-// TODO%0A        return
+int result = 0;%0A        for (int i = 0; i %3C 32; i++) %7B%0A            int count =
  0;%0A    
 %7D%0A%0A 
@@ -251,180 +251,200 @@
     
+  
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem477 prob = new Problem477();%0A        System.out.println(prob.totalHammingDistance(new int%5B%5D%7B4, 14, 2%7D)); // 6
+  for (int j = 0; j %3C nums.length; j++) %7B%0A                count += 1 & (nums%5Bj%5D %3E%3E i);%0A            %7D%0A            result += (nums.length - count) * count;%0A        %7D%0A        return result;
 %0A   

Solve problem 477