C++ 1-Liner Using BuiltIn PopCount


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

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.