Problem Description
Given an array of integers A, 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?
1 <= |A| <= 2000000
0 <= A[i] <= INTMAX
First and only argument of input contains an integer array A.
Return a single integer denoting the single element.
Input 1:
A = [1, 2, 2, 3, 1]
Input 2:
A = [1, 2, 2]
Output 1:
3
Output 2:
1
Explanation 1:
3 occurs once.
Explanation 2:
1 occurs once.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.