/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param nums int整型一维数组
* @return int整型一维数组
*/
function FindNumsAppearOnce( nums ) {
// write code here
const map = new Map();
const result = [];
for(let n of nums){
if(map.has(n)){
map.delete(n)
}else{
map.set(n,1);
}
};
for(let [key,val] of map){
if(val===1){
result.push(key);
}
}
return result[0]<result[1]?result:[result[1],result[0]];
}
module.exports = {
FindNumsAppearOnce : FindNumsAppearOnce
};

京公网安备 11010502036488号