https://leetcode.com/problems/…
盲敲,一遍过,:)
class Solution {
public:
int hammingDistance(int x, int y) {
int res = x ^ y;
int cnt = 0;
while (res) {
if (res % 2) {
cnt++;
}
res /= 2;
}
return cnt;
}
};