You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include<string>
#include<vector>
#include<algorithm>usingnamespacestd;
string solution(vector<int> numbers) {
vector<string> strNumbers;
for (int num : numbers) {
strNumbers.push_back(to_string(num));
}
sort(strNumbers.begin(), strNumbers.end(), [](const string& a, const string& b) {
return a + b > b + a;
});
if (strNumbers[0] == "0") {
return"0";
}
string result = "";
for (const string& num : strNumbers) {
result += num;
}
return result;
}
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: