Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
817 views
in Technique[技术] by (71.8m points)

string - What is an easy way to tell if a list of words are anagrams of each other?

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 rearranged into carthorse with all original letters used exactly once therefore the words are anagrams of each other.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Put all the letters in alphabetical order in the string (sorting algorithm) and then compare the resulting string.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...