Lonely Integer

  • + 0 comments

    golang solution using XOR:

    func lonelyinteger(a []int32) int32 {
        var unique int32 = 0
        
        for _, i := range a{
            unique ^= i
        }
        
        return unique
    
    }