Skip to content

Instantly share code, notes, and snippets.

@bernEsp
Created August 28, 2014 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bernEsp/fb55e07180788b568b4c to your computer and use it in GitHub Desktop.
Save bernEsp/fb55e07180788b568b4c to your computer and use it in GitHub Desktop.
write a function that receives two list of strings and compare strings in the same index if they are anagram
def anagram(first_word, second_word)
anagrams = []
first_word.each_with_index do |element, index|
anagrams << {"#{element.downcase}" => "#{second_word[index].downcase}" } if element.downcase.sum == second_word[index].downcase.sum
end
anagrams
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment