Four Line Bit Operation by JavaScript


  • 0
    Y

    var getSum = function(a, b) {
    var x = a ^ b;
    var y= a & b;
    if(y == 0) return x;
    else return getSum(x, y << 1);
    };


Log in to reply
 

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