function solution(A) {
// write your code in JavaScript (Node.js 8.9.4)
let element = new Set();
for(let i in A){
if(!element.has(A[i])){
element.add(A[i]);
}
else{
element.delete(A[i]);
}
}
const result = [...element];
return result[0];
}
def test3(A):
if len(A) == 1:
return A[0]
A = sorted(A)
print(A)
for i in range(0, len(A), 2):
if i+1 == len(A):
return A[i]
if A[i] != A[i+1]:
return A[i]
test3([1,2,1,2,3])