javascript solution


  • 0
    F
    var singleNumber = function(nums) {
        const arr = []
        for (let i = 0; i < 32; i++) {
            arr.unshift(nums.reduce((pre, cur) => pre + (cur >> i & 1), 0) % 3)
        }
        return parseInt(arr.join(''), 2) | 0
    };
    

  • 0
    L

    you solution is so smart!!!


Log in to reply
 

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