Single Number
Given an array of integers, every element appears twice except for one. Find that single one.
和上一题比这题就是渣。
class Solution { public: int singleNumber(int A[], int n) { if(A == NULL)return 0; int re = 0; for(int i = 0 ; i < n ;i++)re ^= A[i]; return re; } };
posted on 2014-03-26 21:50 pengyu2003 阅读(93) 评论(0) 编辑 收藏 举报