题解 | #出现一次的数字#
出现一次的数字
http://www.nowcoder.com/practice/0bc646909e474ac5b031ec6836a47768
使用JS自带的indexOf函数与lastIndexOf函数
/**
*
* @param A int整型一维数组
* @return int整型
*/
function singleNumber( A ) {
// write code here
for(let item of A){
if(A.indexOf(item)===A.lastIndexOf(item)){
return item;
}
}
}
module.exports = {
singleNumber : singleNumber
}; 