LeetCode July Challenge - Day 5

Problem: LeetCode July Challenge - Day 5

Solution:

class Solution {
public:
    int hammingDistance(int x, int y) {
        return __builtin_popcount(x^y);
    }
};