singleNumber Posted on 2019-09-28 Edited on 2019-10-16 In JavaScript 12345678910/** * @param {number[]} nums * @return {number} */var singleNumber = function(nums: number[]) { return [...nums.reduce((prev, v)=>{ prev.has(v) ? prev.delete(v) : prev.add(v); return prev }, new Set())][0];};