What is the best way to remove from the array elements that are repeated. For example, from the array
a = [4, 3, 3, 1, 6, 6]
need to get >
arr = [4, 3, 3, 1, 6, 6] arr. group_by {|e| e }. map {|e, es| [e, es.length] }. reject {|e, count| count > 1 }. map(&:first) # [4, 1]