Group the Anagrams

Talk it through out loud with your AI coach.

The problem

  • medium
  • Pro

You're given a list of lowercase words. Group together the words that are anagrams of each other — words made of exactly the same letters in a different order — and return the groups in any order.

What a strong answer covers

  • What all words in one group share, and how to turn that into something you can look up.
  • The data structure that collects each group.
  • The cost in terms of both the number of words and their length.
  • Edge cases such as empty words or words with no partner.

Common mistake: Comparing every word with every other word instead of finding a shared key.

Knowing this is half of it. Saying it clearly out loud is the part the coach helps you practise.

Practise it out loud