题解 | 不重复数字

不重复数字

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)))

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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