全排列复杂度太高
class Solution {
public:
vector> groupAnagrams(vector& strs) {
unordered_map>a;
for(auto str : strs)
{
auto str1=str;
sort(str1.begin(), str1.end());
auto it = a.find(str1);
if(it==a.end())
a.insert(pair>(str1, vector{str}));
else
it->second.push_back(str);
}
vector>ret;
for(auto x:a)
{
ret.push_back(x.second);
}
return ret;
}
};



