#include <string>
#include <vector>
#include<algorithm>
#include<iostream>
using namespace std;
bool cmp(string &a, string &b) {
return a + b > b + a;
}
string solution(vector<int> numbers) {
string answer = "";
vector<string> temp;
for(auto elem : numbers)
temp.push_back(to_string(elem));
sort(temp.begin(), temp.end(), cmp);
for(auto elem : temp)
answer += elem;
if(answer[0] == '0')
return "0";
return answer;
}
'알고리즘 > 프로그래머스 문제풀이' 카테고리의 다른 글
[프로그래머스] 기능개발 / C++ (0) | 2020.08.24 |
---|---|
[프로그래머스] 스택,큐 / 다리를 지나는 트럭 (0) | 2020.08.24 |
[프로그래머스] 스택,큐 / 주식가격 (0) | 2020.08.11 |
[프로그래머스] 정렬 / k번째 수 (0) | 2020.08.07 |
[프로그래머스] 해싱 / 위장 (0) | 2020.08.07 |