웅재의 코딩세상

[프로그래머스] 문자열 내림차순으로 배치하기 본문

코딩테스트/프로그래머스 - LV 1

[프로그래머스] 문자열 내림차순으로 배치하기

웅드 2024. 2. 9. 17:24

 

  • 풀이
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

string solution(string s) {
    string answer = "";
    sort(s.rbegin(), s.rend());
    answer = s;
    return answer;
}
반응형