c++ solution: use map, easy solution

  • 0
    vector<vector<string>> groupAnagrams(vector<string>& strs) 
        vector<vector<string> > result;
        map<string, vector<string> > words;
        for (int i = 0; i < strs.size(); i++)
            string str = strs[i];
            sort(str.begin(), str.end());
        for (map<string, vector<string> >::iterator it = words.begin(); it != words.end(); ++it)
        return result;

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.