Python解法:哈希

思路类似字符串第一个出现一次的字符差不多

# -*- coding:utf-8 -*-
from collections import Counter#哈希解法
class Solution:
    # 返回[a,b] 其中ab是出现一次的两个数字
    def FindNumsAppearOnce(self, array):
        # write code here
            dict=Counter(array)
            res=[]
            for i in array:
                if dict[i]==1:
                    res.append(i)
            return res
全部评论

相关推荐

不愿透露姓名的神秘牛友
07-01 11:27
点赞 评论 收藏
分享
龙珠传说:nb,公务员解约不需要支付违约金吧
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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