function solution(A) {
let map = {};

for (let i = 0, n = A.length; i < n; i++) {
let key = A[i];

if (!map[key]) {
map[key] = 0;
}

map[key]++;
}

for (let key in map) {
if (map[key] % 2 === 1) {
return parseInt(key);
}
}
}


'IT General' 카테고리의 다른 글

Codility #3-PermMissingElem  (0) 2018.08.18
Codility #3-FrogJmp  (0) 2018.08.18
Codility #2-CyclicRotation  (0) 2018.08.18
Fibonacci function without recursion  (0) 2018.08.15
Codility #1-BinaryGap  (0) 2018.08.15

+ Recent posts