Created
December 15, 2011 22:35
-
-
Save JakeAustwick/1483263 to your computer and use it in GitHub Desktop.
Ruby Dups
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def duplicates(list) | |
list.group_by { |e| e }.select { |k,v| v.size > 1 }.map(&:first) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment