标签:
Given an array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
Hash Table Bit Manipulation
1 class Solution { 2 public: 3 int singleNumber(int A[], int n) { 4 int x; 5 for(size_t i=0; i<n; ++i) 6 x ^= A[i]; 7 return x; 8 } 9 };
1 int singleNumber(int A[], int n) { 2 if (n < 1) 3 return NULL; 4 int x = A[0]; 5 for(size_t i=1; i<n; ++i) 6 x ^= A[i]; 7 return x; 8 }
此时竟然不AC了,提示Compile Error
Line 19: no matching function for call to ‘Solution::singleNumber(std::vector<int>&)’
【LeetCode】136.Excel Sheet Column Title
标签:
原文地址:http://www.cnblogs.com/helloWaston/p/4482984.html