# 136. 只出现一次的数字

var singleNumber = function(nums) {
  let ans = 0;

  for (const num of nums) {
    ans ^= num;
    console.log(ans, num);
  }
};

const nums = [1, 2, 6, 1, 2];

console.log(singleNumber(nums));
1
2
3
4
5
6
7
8
9
10
11
12
Last Updated: 6/27/2023, 7:40:45 PM