Skip to content

Instantly share code, notes, and snippets.

@8bit-pixies
Created December 27, 2012 09:52
Show Gist options
  • Save 8bit-pixies/4386998 to your computer and use it in GitHub Desktop.
Save 8bit-pixies/4386998 to your computer and use it in GitHub Desktop.
challenge 80
#chall80
#anagrams - no bonus
#idea, each word will have a 'fingerprint' by alphabetical ordering of the word
def anagram(m)
File.open('enable1.txt').map {|word|
word.chomp.chars.sort.join == m.chars.sort.join ? word.chomp : nil
}.compact
end
p anagram('pagers')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment