Dsa
Hashing
Medium
Grouped Anagrams
Given a list of strings, group the anagrams together. Return the grouped anagrams as a list of lists. An anagram is a word formed by rearranging the letters of another, such as 'cinema' and 'iceman'.
Input:
A single line containing space-separated strings.
Output:
A list of lists containing grouped anagrams.
Example:
Input:
'bat tab eat tea tan ate nat'
Output:
[['bat', 'tab'], ['eat', 'tea', 'ate'], ['tan', 'nat']]
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