标签:lint const his int turn pass htm style white
Given 2*n + 1
numbers, every numbers occurs twice except one, find it.
Given [1,2,2,1,3,4,3]
, return 4
One-pass, constant extra space.
LeetCode上的原题,请参见我之前的博客Single Number。
class Solution { public: int singleNumber(vector<int>& nums) { int res = 0; for (auto num : nums) res ^= num; return res; } };
[LintCode] Single Number 单独的数字
标签:lint const his int turn pass htm style white
原文地址:http://www.cnblogs.com/grandyang/p/6035198.html