442-find-all-duplicates-in-an-array
DevGod needs to write a blog entry for this problem!
/**
* @param {number[]} nums
* @return {number[]}
*/
var findDuplicates = function(nums) {
let mySet = new Set();
let dupSet = new Set();
for(let num of nums){
if(!mySet.has(num)){
mySet.add(num);
}else{
dupSet.add(num);
mySet.delete(num);
}
}
return [...dupSet];
};