Group Anagrams

Medium
Strings Hash Table Sorting
Given an array of strings, group the anagrams together. Input: comma-separated strings Output: groups on separate lines, words comma-separated within each group, sorted alphabetically

Constraints

1 <= strs.length <= 10000 0 <= strs[i].length <= 100 strs[i] consists of lowercase English letters.

Examples

Example 1:
Input: eat,tea,tan,ate,nat,bat
Output:
Example 2:
Input:
Output:

Hints

Use sorted string as hash key.
A dictionary/map groups anagrams.
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.