How would you list words that are anagrams of each other?
I was asked this question when I applied for my current job.
orchestra can be rearrang
orchestra
The following algorithm should work:
Sort the letters in each word.
Sort the sorted lists of letters in each list.
Compare each element in each list for equality.