sort함수의 comp 함수만 조절해 내림차순으로 sorting했다.
#include <string>
#include <algorithm>
using namespace std;
bool comp(char a, char b)
{
return a > b;
}
string solution(string s) {
sort(s.begin(), s.end(), comp);
return s;
}'Coding_Test 연습 > Programmers' 카테고리의 다른 글
| [프로그래머스] (C++) LV1 서울에서 김서방 찾기 (0) | 2022.04.26 |
|---|---|
| [프로그래머스] (C++) LV1 문자열 다루기 기본 (0) | 2022.04.26 |
| [프로그래머스] (C++) LV1 문자열 내 p와 y의 개수 (0) | 2022.04.26 |
| [프로그래머스] (C++) LV1 문자열 내 마음대로 정렬하기 (0) | 2022.04.26 |
| [프로그래머스] (C++) LV1 나누어 떨어지는 숫자 배열 (0) | 2022.04.25 |