题解 | #明明的随机数#
明明的随机数
http://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const nums=[]
rl.on('line', function (line) {
nums.push(line)
if(nums.length===Number(nums[0])+1){
nums.shift();
// 先Set去重,然后转换成数组并排序。最后按个输出
let finalNums=Array.from(new Set(nums)).sort((a,b)=>a-b);
finalNums.forEach(f=>console.log(f));
}
});