Bit Manipulation: Lonely Integer

  • + 0 comments

    Tiny Ruby solution:

    def find_lonely(arr)
      arr.inject(&:^)
    end
    
    _n = gets.to_i
    arr = gets.split.map(&:to_i)
    puts find_lonely(arr)