Skip to content

Commit 0073c7b

Browse files
authored
Update total-hamming-distance.cpp
1 parent 53be79d commit 0073c7b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

C++/total-hamming-distance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Solution {
88
for (int i = 0; i < 8 * sizeof(int); ++i) {
99
vector<int> counts(2);
1010
for (const auto& num : nums) {
11-
++counts[(num >> i) % 2];
11+
++counts[(num >> i) & 1];
1212
}
1313
result += counts[0] * counts[1];
1414
}

0 commit comments

Comments
 (0)