Question bank › Hashing
Dsa Hashing Hard

Anagram Grouping

You are given a list of words. Your task is to group the words that are anagrams of each other and print the groups. Each group should be printed on a new line and words within a group should be space-separated, while groups themselves should be in the order of their first occurrence. Input Format: - The first line contains an integer n (1 <= n <= 1000): number of words. - The following n lines each contain a single word (lowercase letters only). Output Format: - Print each group of anagrams on a new line. Example: Input: 5 listen silent enlist inlets hello Output: listen silent enlist inlets hello

Key concepts

hashingstringsgrouping

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.