0049.Group Anagrams
class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
unordered_map<string, vector<string>> map1;
vector<vector<string>> result;
for(string str : strs){
string key = str;
sort(key.begin(), key.end());
map1[key].push_back(str);
}
for(auto it = map1.begin(); it != map1.end(); it++){
result.push_back(it->second);
}
return result;
}
};