遇到这种要看重不重复的,第一反应就是会想到用dict去判断

class Solution:
    def FindNumsAppearOnce(self , array ):
        # write code here
        dic = dict()
        for i in array:
            if i not in dic:
                dic[i] = True
            else:
                dic[i] = False
        res = []
        for j in dic:
            if dic[j] == True:
                res.append(j)
        return sorted(res)

or

class Solution:
    def FindNumsAppearOnce(self , array ):
        # write code here
        dic = dict()
        for i in array:
            if i not in dic:
                dic[i] = True
            else:
                dic[i] = False
        res = []
        for key,value in dic.items():
            if value == True:
                res.append(key)
        return sorted(res)