题解 | #明明的随机数#

明明的随机数

https://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0

const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;

void async function () {
    // map的键
    // Write your code here
    let N = parseInt(await readline());
    // let numN = [];
    let map = new Map();
    while(line = await readline()){
        let num = parseInt(line);
        map.set(num, (map.get(num) || 0) + 1);
    }
    let res = Array.from(map.keys()).sort((a,b)=> a-b);
    for(let i = 0; i<res.length; i++)
        console.log(res[i]);
}()

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-10 11:55
点赞 评论 收藏
分享
苍蓝星上艾露:这简历。。。可以试试我写的开源简历优化工具https://github.com/weicanie/prisma-ai
点赞 评论 收藏
分享
Rena1ssanc...:对的,要是面评没太烂,勤更新简历等捞就行了,腾讯可以无限复活
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务