49. Group Anagrams
Given an array of strings, group anagrams together.
For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"],
Return:
[
["ate", "eat","tea"],
["nat","tan"],
["bat"]
]
Note: All inputs will be in lower-case.
public class Solution {
public List> groupAnagrams(String[] strs) {
Map
> res = new ArrayList
>();
for(String key : map.keySet()){
List