Question bank › Trie
Dsa Trie Easy

Identify Anagrams

You need to determine if a list of words can be grouped into anagrams. A group of words is considered an anagram group if each word can be rearranged to form the other words in the group. Write a program that reads a list of words and outputs groups of anagrams. Input format: - The first line contains an integer N, the number of words. - The next N lines each contain a single word consisting of lowercase letters only. Output format: - Output each group of anagrams on a new line, with words separated by spaces. Example: Input: 5 bat tab cat act rat Output: bat tab cat act rat

Key concepts

trieanagramsstrings

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.