Dsa
Hashing
Easy
Group Anagrams
Given a list of strings, group the anagrams together. Anagrams are words that are formed by rearranging the letters of another word.
Input Format:
A single line of space-separated words.
Output Format:
A list of lists, where each inner list contains anagrams grouped together.
Example:
Input:
eat tea tan ate nat bat
Output:
[['eat', 'tea', 'ate'], ['tan', 'nat'], ['bat']]
Key concepts
hashingdictionarieslists
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