Given an array of strings, group anagrams together.
For example, given: ["eat", "tea", "tan", "ate",
"nat", "bat"]
,
Return:
Note:
Subscribe to see which companies asked this question
思路:
使用先将字符串数组排序(这样可以保证输出的顺序);
使用HashMap<String, List<String>>,key(String):是第1次出现的字符串;value(List<String>):用于保存所有相同字母乱序的值。
java code: