Problem [127] Anagrams

Back to General discussions forum

David_Kolln     2017-01-16 19:19:55

The problem statement says to count the number of words occurring in the dictionary list for a given word. In the example it says that the word "lots" should have 2 words associated with it however I see four words.

  • lo line 32439
  • ls line 32843
  • ts line 58942
  • lot line 32744

Not quite sure how to solve this one if the results in the problem check are not accurate...

Quandray     2017-01-16 20:27:01
User avatar

This problem is about anagrams; the same letters, but in a different order.

The two anagrams of "lots" are "slot" and "lots"

David_Kolln     2017-01-17 04:25:01

ah ok thank you I appreciate the clarification.

Quandray     2017-01-17 09:53:39
User avatar

Sorry, that should have said, the two anagrams of "lots" are "slot" and "lost".

Prabhat_SY     2020-11-18 13:44:38

For this example hearsed headers hearsed headers adheres adheres sheared sheared I am getting 7 anagrams but the answer is saying 3. In this I first permutated all the possiblities of hearsed and then compared it to the list we have.

Quandray     2020-11-19 18:34:18
User avatar

Your 7 contains duplicates and the original word.

pascal65536     2021-06-28 14:25:56

Hello, World!

I wrote a program to search for anagrams, but the result does not pass validation.

Expected answer was: 4 5 3 3 3 4 3 4 3 My program answer was: 8 5 3 8 3 4 4 4 3

The input data is as follows: 9 spriest parsed editors parries tasking sering altered salted scanter

My program found such words in the dictionary. They really exist: ['persist', 'priests', 'respite', 'sprites', 'stripes', 'tippers', 'tipsier', 'tipster'] ['drapes', 'padres', 'rasped', 'spared', 'spread'] ['sortied', 'steroid', 'storied'] ['apprise', 'aspires', 'praises', 'rapiers', 'raspier', 'repairs', 'sappier', 'spireas'] ['skating', 'staking', 'takings'] ['reigns', 'resign', 'signer', 'singer'] ['alerted', 'rattled', 'related', 'treadle'] ['deltas', 'lasted', 'slated', 'staled'] ['canters', 'recants', 'trances']

And this happens in all cases when the program is launched. What am I doing wrong?

Quandray     2021-06-28 17:25:40
User avatar

tippers, respite, tipsier and tipster aren't anagrams of spriest

pascal65536     2021-06-29 16:58:18

Thank you. From now on I will be attentive

Please login and solve 5 problems to be able to post at forum