// Task: Given array of size 2*N-1, containing N-1 pairs of same integers and one unique integer.
// Find unique integer without sorting array - it's too big
// Complexity: O(n)
let findUnique = function(lst) {
let map = new Map();
lst.forEach((id) => {
if (map.has(id)) map.delete(id);
else map.set(id, 1);
})
for (let id of map.keys()) {
if (map.get(id) === 1) return id;
}
}
let arr = [1, 1, 5, 7, 8, 5, 100, 9, 7, 8, 9];
console.log(findUnique(arr)); // 100