image_2021-11-11_21-35-59.png
23.6 KB
#N136. Single Number
problem link
#solution
problem link
#solution
class Solution {
public int singleNumber(int[] nums) {
int ans = 0;
int len = nums.length;
for(int i = 0; i != len; i++)
ans ^= nums[i];
return ans;
}
}
p.s. good problem to understand XOR operator better)