题解 | 不重复数字

不重复数字

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

t = int(input())
for _ in range(t):
    n = int(input())
    a = list(map(int,input().split()))
    seen, ans = set(), []
    for c in a:
        if c not in seen:
            seen.add(c)
            ans.append(c)
    print(' '.join(map(str,ans)))

全部评论

相关推荐

不愿透露姓名的神秘牛友
12-10 15:21
华为-媒体院 算法 n*16 硕士985
点赞 评论 收藏
分享
12-01 14:24
吉首大学 Java
点赞 评论 收藏
分享
哇哇的菜鸡oc:他这不叫校招offer,而是实习offer
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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