题解 | 不重复数字

不重复数字

https://www.nowcoder.com/practice/38532b5539164242b4252352be8749ab

# cs = int(input())
# for i in range(cs):
#     n = input()
#     num =list(map(int,input().split()))
#     b = set(num)
#     ans = list(b)
#     print(" ".join(str(x) for x in b))
cs = int(input())
for _ in range(cs):
    n = input()
    num =list(map(int,input().split()))
    print(" ".join(str(x) for x in list(dict.fromkeys(num))))

dict.fromkeys() 有序去重,set无序去重

全部评论

相关推荐

joecii:如果没有工资,那可能没有工资是这家公司最小的问题了
找实习记录
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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