/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param nums int整型一维数组 * @return int整型一维数组 */ function FindNumsAppearOnce(nums) { // write code here if (nums.length < 2) return null; const record = {}; for (let n of nums) { if(record[n]){record[n]++} else{record[n] = 1} } let res = [] for(i in record){ if(record[i]>=2){continue} else{res.push(i)} } res = res.sort((a,b)=>{a-b}) return res } module.exports = { FindNumsAppearOnce: FindNumsAppearOnce, };