Try
[Programmers/C++] 가장 큰 수 본문
출처
https://programmers.co.kr/learn/courses/30/lessons/42746?language=cpp
소스
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34  | #include <algorithm> #include <string> #include <vector> #include <iostream> using namespace std; bool compare(string &a, string &b) {     cout << a << b << endl;     if (b + a < a + b)         return true;     return false; } string solution(vector<int> numbers) {     string answer = "";     vector<string> strings;     for (int i : numbers)         strings.push_back(to_string(i));     sort(strings.begin(), strings.end(), compare);     for (int i = 0; i< strings.size(); i++){         answer += strings[i];     }     if (answer[0] == '0')         answer = "0";     return answer; }  | cs | 
'Algorithm > Programmers' 카테고리의 다른 글
| [Programmers/Python] 구명보트 (0) | 2019.03.23 | 
|---|---|
| [Programmers/C++] 구명보트 (0) | 2019.03.23 | 
| [Programmers/Python] 영어 끝말잇기 (0) | 2019.03.21 | 
| [Programmers/C++] 영어 끝말잇기 (1) | 2019.03.21 | 
| [Programmers/Python] 예산 (0) | 2019.03.21 | 
			  Comments