您的位置:首页 > 其它

LeetCode Single Number

2014-10-13 11:34 211 查看
主要思想为相同的数异或之后为0

class Solution {

public:

int singleNumber(int A[], int n) {

int temp=A[0];

for(int i=1;i<n;i++){

temp=temp^A[i];

}

return temp;

}

};
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: