标签:problems des ring nbsp etc cond for multiset ret
https://leetcode.com/problems/group-anagrams/description/
class Solution { public: vector<vector<string>> groupAnagrams(vector<string>& strs) { unordered_map<string,multiset<string>> m; for (auto s : strs) { string ss = s; sort(ss.begin(), ss.end()); m[ss].insert(s); } vector<vector<string>> res; for (const auto& p : m) { vector<string> v; for (const auto& s : p.second) v.push_back(s); res.push_back(v); } return res; } };
标签:problems des ring nbsp etc cond for multiset ret
原文地址:https://www.cnblogs.com/JTechRoad/p/9060064.html