Skip to content

Instantly share code, notes, and snippets.

@nimamehanian
Created February 21, 2013 02:29
Show Gist options
  • Save nimamehanian/5001494 to your computer and use it in GitHub Desktop.
Save nimamehanian/5001494 to your computer and use it in GitHub Desktop.
Determine whether two strings are anagrams.
def anagrams?(word_one, word_two)
word_one = word_one.split('').sort
word_two = word_two.split('').sort
word_one == word_two ? true : false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment