Guest User

Untitled

a guest
Jul 23rd, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.17 KB | None | 0 0
  1. comps = ["PC", "MAC", "PC", "PC", "LINUX", "MAC", "DIDAKTIK"]
  2.  
  3. duplicities = comps.group_by{|x| x.first}.find_all{|k,v| v.size > 1}.map{|x| x.first}
  4.  
  5. duplicities # => ["MAC","PC"]
Add Comment
Please, Sign In to add comment