Lonely Integer

  • + 0 comments
    def lonelyinteger(a):
        unique=0
        for i in a:
            unique=i^unique
        return unique
            
    

    explanation : a^a=0 a^0=a...so if the element is unique we get the element as the result