Tianhe Gao

LC 136. Single Number

 1/**
 2 * @param {number[]} nums
 3 * @return {number}
 4 */
 5var singleNumber = function(nums) {
 6  let ans = 0
 7  for (const num of nums) {
 8    ans ^= num
 9  }
10  return ans
11};

No notes link to this note

Welcome to tell me your thoughts via "email"
UP