您的位置:首页 > 其它

leetcode - Single Number

2013-10-14 10:37 351 查看
class Solution {
public:
int singleNumber(int A[], int n) {
// Note: The Solution object is instantiated only once and is reused by each test case.
if (n<=0)
return 0;
int ans=0;
for (int i=0; i<n; i++)
ans ^= A[i];
return ans;
}
};
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: