题解 | #明明的随机数#

明明的随机数

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


const lists = []
// 先读取所有行数再处理
while(line = readline()){
    lists.push(+line)
}

let length = lists.length
while(length > 0){
    handleList(lists)
    length = lists.length
}

 /* 分治 */ 
function handleList(list){
    const count = list.shift();
    const arr = list.splice(0, count)
    sortnPrint(arr)
}

/* 数组排序输出 */
function sortnPrint(arr){
    return [...new Set(arr)].sort((a,b)=>a-b).forEach( v=>print(v))
}

全部评论

相关推荐

不愿透露姓名的神秘牛友
今天 16:22
主包是26应届生,投大厂简历一直过不了初筛,想问问大家有必要花钱改简历吗
Java抽象带篮子:我之前专门发个帖子说不要付费改简历的,里面还详细写了简历怎么写,你可以去看看
点赞 评论 收藏
分享
认真搞学习:这么良心的老板真少见
点赞 评论 收藏
分享
流浪的神仙:无恶意,算法一般好像都得9硕才能干算法太卷啦
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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