题解 | #提取不重复的整数#
提取不重复的整数
http://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
while(count = readline()){
// printAll(count);
// fin = []
// for(let i =count.length-1;i >=0;i--) {
// fin.push(count[i])
// }
// res = []
// // 去重
// for(let i of fin) {
// if(res.indexOf(i)==-1){
// res.push(i)
// }
// }
res = []
for(let i =count.length-1;i >=0;i--) {
if(res.indexOf(count[i])<0){
res.push(count[i])
}
}
console.log(res.join(''))
}
for+if直接实现即可. 这题也算中等难度。。就是个简单题。。什么解决不了for+if哈哈哈
查看13道真题和解析