Python using Counter


  • 0
    U
    class Solution(object):
        def singleNumber(self, nums):
            """
            :type nums: List[int]
            :rtype: List[int]
            """
            from collections import Counter
            L = []
            for key,value in Counter(nums).items():
                if value ==1:
                    L.append(key)
            return L
            
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.