# Leetcode 477 - Total Hamming Distance

Note:

• Every time use mask to seprate nums into two groups based on the bit is 0 or 1.
• Then at that position, there would be a * b combinations.
• Update ans and our mask to keep going.

Question:

The Hamming distance between two integers is the number of positions at which the corresponding bits are different.

Given an integer array nums, return the sum of Hamming distances between all the pairs of the integers in nums.

Example:

Code: