# LeetCode : 136. Single Number

Given an array of integers, every element appears twice except for one. Find that single one.

Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?

AC代码如下：

 int singleNumber(vector<int>& nums)
{
int ans = 0;
for(int i = 0;i < nums.size();i++)
{
ans = ans^nums[i];
}
return ans;
}

• 本文已收录于以下专栏：

## LeetCode P136 Single Number及异或知识

Given an array of integers, every element appears twice except for one. Find that single one. Note:...

## [LeetCode]--136. Single Number

Given an array of integers, every element appears twice except for one. Find that single one.Note: ...

## leetcode 136. Single Number

/* leetcode 136. Single Number Given an array of integers, every element appears twice except for on...

## leetcode(136)_Single Number

//每天各种生活琐事简直焦头烂额 //感觉毕业后就可以过上失业的生活了 //所以说被打乱节奏以至于还没找到工作的我对于“拥抱变化”神马的还是有点怨念 //其实还是自己的锅啦 //好像节奏有点慢...

## <LeetCode OJ> 136 / 137 / 260 Single Number（I / II / III）

260. Single Number III My Submissions Question Total Accepted: 19802 Total Submissions: 47891 Di...

## Leetcode No. 136. Single Number

Given an array of integers, every element appears twice except for one. Find that single one.Note: ...

举报原因： 您举报文章：LeetCode : 136. Single Number 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)