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