You are viewing a single comment's thread. Return to all comments →
cpp solution a little bit less pretty, as I didn't specify the sorting function.
vector<string> bigSorting(vector<string> unsorted) { vector<pair<int, string>> vec; for (auto uns : unsorted) { vec.push_back(make_pair(uns.length(), uns)); } sort(vec.begin(), vec.end()); vector<string> rvec = {}; for (int i = 0; i < vec.size(); i++) { rvec.push_back(vec[i].second); } return rvec; }
Seems like cookies are disabled on this browser, please enable them to open this website
Big Sorting
You are viewing a single comment's thread. Return to all comments →
cpp solution a little bit less pretty, as I didn't specify the sorting function.