Skip to content

geekchick/anagram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

4 Ways to Code an Anagram in Python

An anagram is word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.[1] For example, the word anagram can be rearranged into "nag a ram".

4 Ways to Code an Anagram

  1. Most efficient solution in O(n) time complexity: Create two dictionaries, loop through each dictionary and get the count for each letter, compare the dictionaries to see if a letter is inside the other
  2. Checking off each letter in word 1 to see if it appears in word 2
  3. Sort each word alphabetically and compare words
  4. Count each letter and compare

About

Multiple Ways to Code an Anagram in Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages