using sort() in STL to sort an array

后端 未结 6 2131
无人共我
无人共我 2020-12-10 19:31

I am writing code for a question which is: Write a method to sort an array of strings so that all the anagrams are next to each other. If my container is vector, it will be

6条回答
  •  眼角桃花
    2020-12-10 19:36

    int sortStrarr(string strarr[], int len){
         sort(&strarr[0],&strarr[len],compare) ;
        //sort(strarr's iterator.begin, strarr's iterator.end, compare); ???
    }
    

提交回复
热议问题