Sale
Summer Offer: $190/yr $99/yr
00 : 00 : 00 : 00
Get this deal
Backend Engineer Senior programming

Given a list of strings, find and return all the unique anagrams from the list. Two words are considered anagrams if they contain the same letters in a different order.


Constraints:


  • 1 <= words.length <= 5000

  • 1 <= words[i].length <= 100

  • The input contains only lowercase alphabets.


Examples:


1. Input: words = ["dormitory", "dirty room", "the eyes", "they see", "below", "elbow"]
Output: [["dormitory", "dirty room"],["the eyes", "they see"],["below", "elbow"]]
2. Input: words = ["listen", "silent", "enlist", "inlets"]
Output: [["listen", "silent", "enlist", "inlets"]]
Suggested Answer

Trusted by 100+ professionals preparing for interviews

Trusted by 100+ professionals 50+ Company Question Banks 5+ Supported Languages

Practice More Questions Like This

Generate unlimited interview questions with structured answers, code runner, and AI-powered walkthroughs.

Get Started Free
Link copied to clipboard