group anagrams
https://leetcode.com/problems/anagrams/
class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
vector<vector<string>> rst;
if(strs.size() == 0)
{
return rst;
}
map<string, vector<string>> hash;
for(string str : strs)
{
string org = str;
sort(str.begin(), str.end());
hash[str].push_back(org);
}
for(auto& kv : hash)
{
rst.push_back(kv.second);
}
return rst;
}
};