프로그래머스 가장큰수 [c++]


프로그래머스 가장큰수 [c++]

#include #include #include #include #include using namespace std; bool cmp(string a, string b) { return a + b > b + a;// ex) a=10, b=2 -> a+b=102, b+a=210 } string solution(vector numbers) { string answer = ""; vectorv; for (int i = 0; i < numbers.size(); i++) v.push_back(to_string(numbers[i])); sort(v.begin(), v.end(),cmp);//내림차순으로 정렬, cmp함수의 조건을 만족하도록 정렬된다 for (auto it = v.begin();it != v.end(..


원문링크 : 프로그래머스 가장큰수 [c++]