string Solution::largestNumber(const vector<int> &A){ vector<string> AA; for(auto& a : A) AA.push_back(to_string(a)); sort(rbegin(AA), rend(AA), [](auto a, auto b) { return a + b < b + a; }); string res = ""; for(auto& s : AA) res+=s; reverse(begin(res), end(res)); while(res.size() > 1and res.back() == '0') res.pop_back(); reverse(begin(res), end(res)); return res; }