题解 | #把数组排成最小的数#
把数组排成最小的数
https://www.nowcoder.com/practice/8fecd3f8ba334add803bf2a06af1b993
class Solution { public: string PrintMinNumber(vector<int> numbers) { vector<string> ns; for (auto &i: numbers) { ns.push_back(to_string(i)); } sort(ns.begin(), ns.end(), [](string &a, string &b) { return a + b < b + a; }); string res; for (auto &i: ns) res += i; return res; } };