标签:for min content ati ons ++ int const number
1 class Solution { 2 public: 3 static bool mycmp(const int &a, const int &b) { 4 return to_string(a) + to_string(b) < to_string(b) + to_string(a); 5 } 6 string PrintMinNumber(vector<int> numbers) { 7 sort(numbers.begin(), numbers.end(), mycmp); 8 string res = ""; 9 for (int i = 0; i < (int)numbers.size(); i++) { 10 res += to_string(numbers[i]); 11 } 12 return res; 13 } 14 };
类内,需要将其变为静态成员函数。
标签:for min content ati ons ++ int const number
原文地址:https://www.cnblogs.com/qinduanyinghua/p/11410044.html