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