Lonely Integer

  • + 0 comments
    def lonelyinteger(a):
        counter = dict()
        for num in a:
            counter[num] = counter.get(num, 0) +1
        return sorted(counter.items(), key= lambda x: x[1])[0][0]