Bucket Words by Letters
Given a list of lowercase words, group together the words that are made of exactly the same letters (rearrangements of each other).
To make the answer unique: sort the words inside each group alphabetically, then sort the groups by their first word alphabetically. Duplicate words stay in the same group.
Example 1
Input: words = ["tea", "eat", "bat", "ate", "tab", "nat"] Output: [["ate","eat","tea"],["bat","tab"],["nat"]]
Example 2
Input: words = [""] Output: [[""]]
Constraints
- 1 <= words.length <= 10^4
- 0 <= words[i].length <= 100
Hint 1
Words with the same letters share the same sorted-letter key.
Hint 2
Use a map from that key to a list of words, then sort as described.
Good practice for: Frontend Developer, Backend Developer, Full Stack Developer, Mobile App Developer, Game Developer, Automation Test Engineer, Data Engineer
Run checks your code on 2 sample tests. Submit runs all 7 tests, including hidden ones, and earns points. Use console.log to debug. Python's first run can take a few seconds while it starts.