tanchukw

Untitled

Sep 15th, 2015
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.24 KB | None | 0 0
  1. class Solution {
  2. public:
  3.     int singleNumber(vector<int>& nums) {
  4.         int sz = nums.size();
  5.         int ans = nums[0];
  6.         for (int i = 1; i < sz; ++i)
  7.         {
  8.             ans ^= nums[i];
  9.         }
  10.         return ans;
  11.     }
  12. };
Advertisement
Add Comment
Please, Sign In to add comment