0477. Total Hamming Distance
https://leetcode.com/problems/total-hamming-distance
Description
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 1:
Example 2:
Constraints:
1 <= nums.length <= 104
0 <= nums[i] <= 109
The answer for the given input will fit in a 32-bit integer.
ac
Last updated