s4553711
9/16/2017 - 2:52 PM

461.cpp

class Solution {
public:
    int hammingDistance(int x, int y) {
        int dist = 0, n = x ^ y;
        while(n) {
            ++dist;
            n &= n - 1;
        }
        return dist;
    }
};