3 lines JavaScript Straight Forward


  • 0
    Z
    /**
     * @param {number[]} nums
     * @return {number[]}
     */
    var singleNumber = function(nums) {
        let se = new Set();
        for(let num of nums) if(!se.delete(num)) se.add(num);
        return [...se];
    };
    

Log in to reply
 

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