class Solution { public: vector> groupAnagrams(vector& strs) { std::vector > result; int size = strs.size(); // create a map, key is the word, value is the anagram group. std::map > map1; for(int i=0; i >::iterator itr; itr = map1.begin(); while(itr != map1.end()){ // question: do you understand why we do this push_back? result.push_back(itr->second); itr++; } return result; } };