136-single-number

DevGod
Vtuber
/** * @param {number[]} nums * @return {number} */
//Bitwise XORvar singleNumber = function(nums) { let uniqNum = 0; for (let idx = 0; idx < nums.length; idx++) { uniqNum = uniqNum ^ nums[idx]; } return uniqNum;};
//BruteForcevar singleNumber2 = function(nums) { nums.sort(); for(let A=0; A<nums.length; A+=2){ if(nums[A] != nums[A+1]){ return nums[A]; } }};