simple javascript solution


  • 0
    /**
     * @param {number} x
     * @param {number} y
     * @return {number}
     */
    var hammingDistance = function(x, y) {
        var t = x ^ y;
        return t.toString(2).replace(/0/g, '').length;
    };
    

Log in to reply
 

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