Javascript Solution beat > 91%


  • 0
    K
    var hammingDistance = function(x, y) {
        var value = x ^ y;
        var count = 0;
        while(value > 0){
            if(value % 2 !== 0){
                count++
            }
            value = value >> 1;
        }
        return count;
    };
    

Log in to reply
 

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