Largest Number


Hello all,
what about my solution ?
Can someone confirm this is a O(N) Time complexity solution ?/* * Time O(N) complexity * */ struct Comparator { bool operator()(const string& lhs, const string& rhs) { return lhs + rhs > rhs + lhs; } }; class Solution { public: string largestNumber(vector<int>& nums) { string result; vector<string> s; // Edge case int ec = *(max_element(nums.begin(), nums.end())); if (ec == *(min_element(nums.begin(), nums.end())) && ec == 0) return to_string(ec); for (vector<int>::iterator it = nums.begin(); it != nums.end(); ++it) { s.push_back(to_string(*it)); } sort(s.begin(), s.end(), Comparator()); for (vector<string>::iterator it = s.begin(); it != s.end(); ++it) { result += *it; } return result; } };