본문 바로가기
프로그래머스 C++

문자열 내림차순으로 배치하기

by yeni_0224 2024. 9. 20.
728x90
반응형

심신이 격동의 시기를 겪고 있는 요즘
다시 정신 차리고 다시 프로그래머스를 시작하기로 했다.
정신은 차리고 살아가야지.

#include <string>
#include <vector>
#include <algorithm>

using namespace std;

string solution(string s) {
    sort(s.begin(), s.end(), greater<>());
    return s;
}


아스키코드 비교하는 방법을 사용했다.

728x90
반응형