Created
December 27, 2012 09:52
-
-
Save 8bit-pixies/4386998 to your computer and use it in GitHub Desktop.
challenge 80
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
#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