Dsa
Hashing
Medium
Group Anagrams by Frequency
Given a list of strings, return a list of lists where each list contains strings that are anagrams of each other. Each string will only contain lowercase alphabetical characters. Additionally, return the groups sorted by their first member in lexicographical order.
Input Format:
A single line containing space-separated strings. Strings are of length 1 to 100 and can be up to 1000 strings.
Output Format:
Print each group of anagrams in a new line, where the strings in each group are space-separated.
Example:
Input:
act cat tac dog god
Output:
act cat tac
dog god
Key concepts
hashinganagramsgrouping
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