Anagrams Time : Space : 12345678910111213vector<vector<int>> Solution::anagrams(const vector<string> &A) { unordered_map<string, vector<int>> mp; for(int i = 0; i < A.size(); i++) { string s = A[i]; sort(begin(s), end(s)); mp[s].push_back(i+1); } vector<vector<int>> res; for(auto [_,v] : mp) res.push_back(v); sort(begin(res), end(res)); return res;}