字母异位词分组
给定一个字符串数组,将字母异位词组合在一起。字母异位词指字母相同,但排列不同的字符串。
示例:
输入:
["eat", "tea", "tan", "ate", "nat", "bat"]
输出:
[
["ate","eat","tea"],
["nat","tan"],
["bat"]
]
说明:
- 所有输入均为小写字母。
- 不考虑答案输出的顺序。
方法一:排序数组分类
维护一个映射,key为字符串中字符的最小字典序,value为排列不同的字符串
public List<List<String>> groupAnagrams(String[] strs) {
Map<String, List<String>> map = new Hash