본문 바로가기
Problem-solving/프로그래머스

프로그래머스 - 문자열 내림차순으로 배치하기 (C++)

by taehee.kim.dev 2020. 3. 5.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <string>
#include <algorithm>
 
using namespace std;
 
bool compare(char a, char b){
    return a > b;
}
 
string solution(string s) {
 
    sort(s.begin(), s.end(), compare);
 
    return s;
}
cs

댓글