题解 | #字符串最后一个单词的长度#
明明的随机数
http://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0
const N = parseInt(readline());
const set = [];
for (let i = 0; i < N; i++) {
set.push(parseInt(readline()));
}
const randomNum = set.sort((a, b) => a - b);
const newSet = new Set(randomNum);
newSet.forEach((res) => {
console.log(res);
});
- 去重用
new Set()
- 排序用
sort((a,b) => a - b)
- 读取输入值
readline()